from channels.generic.websockets import WebsocketConsumer, JsonWebsocketConsumer
from .jsonrpcwebsocketconsumer import JsonRpcWebsocketConsumer

class MyJsonRpcWebsocketConsumer(JsonRpcWebsocketConsumer):

    # Set to True if you want them, else leave out
    strict_ordering = False
    slight_ordering = False

    def connection_groups(self, **kwargs):
        """
        Called to return the list of groups to automatically add/remove
        this connection to/from.
        """
        return ["test"]

    def receive(self, content, **kwargs):
        """
        Called when a message is received with decoded JSON content
        """
        # Simple echo
        print "received: %s" % content
        print "kwargs %s" % kwargs
        self.send(content)

    def disconnect(self, message, **kwargs):
        """
        Perform things on connection close
        """
        print "disconnect"


@MyJsonRpcWebsocketConsumer.rpc_method()
def ping():
    return "pong"
from channels.generic.websockets import WebsocketConsumer, JsonWebsocketConsumer
from .jsonrpcwebsocketconsumer import JsonRpcWebsocketConsumer

class MyJsonRpcWebsocketConsumer(JsonRpcWebsocketConsumer):

    # Set to True if you want them, else leave out
    strict_ordering = False
    slight_ordering = False

    def connection_groups(self, **kwargs):
        """
        Called to return the list of groups to automatically add/remove
        this connection to/from.
        """
        return ["test"]

    def receive(self, content, **kwargs):
        """
        Called when a message is received with decoded JSON content
        """
        # Simple echo
        print("received: %s" % content)
        print("kwargs %s" % kwargs)
        self.send(content)

    def disconnect(self, message, **kwargs):
        """
        Perform things on connection close
        """
        print("disconnect")


@MyJsonRpcWebsocketConsumer.rpc_method()
def ping():
    return "pong"
Print statements updated to be compatible with Python 3.
Print statements updated to be compatible with Python 3.
