Receive data on server side with django-websocket-redis?

I'm working with django-websocket-redis lib, that allow establish websockets over uwsgi in separated django loop. By the documentation I understand well how to send data from server through websockets, but I don't understand how to receive.

Basically I have client and I want to send periodically from the client to server status. I don't understand what I need to do, to handle receiving messages from client on server side? What URL I should use on client?

Answers


You can achieve that by using periodically ajax calls from client to server. From documentation:

A client wishing to trigger events on the server side, shall use XMLHttpRequests (Ajax), as they are much more suitable, rather than messages sent via Websockets. The main purpose for Websockets is to communicate asynchronously from the server to the client.

Unfortunately I was unable to find the way to achieve it using just websocket messages.


Need Your Help

Why this HTML template on jinja2/python is producing 'u( )' tuple error in string substitution?

python google-app-engine utf-8 jinja2

I wrote the code bellow, but something strange is happening. Some parts of the string substitution with jinga2 are puting the substituted string into 'u( )', this way:

How to create a PriorityQueue with new comparator and NO specified initial capacity?

java priority-queue

in Java, I don't know how to create a new PriorityQueue with new comparator but without given the queue length? How can I create it?