http://channels.readthedocs.io/en/stable/asgi/www.html#receive

def get_receive_message(self, data):
        '''
        http://channels.readthedocs.io/en/stable/asgi/www.html#receive
        '''
        self.order += 1
        message = {
            'channel': 'websocket.receive',
            'reply_channel': None,
            'path': self.path,
            'order': self.order,
            'text': None,
            'bytes': None,
        }
        if isinstance(data, str):
            message['text'] = data
        elif isinstance(data, bytes):
            message['bytes'] = data
        return message