Open danryu opened 8 years ago
I notice at the bottom of https://github.com/jrief/django-websocket-redis/blob/master/docs/installation.rst it says:
Never store session data in the database in combination with Websockets for Redis!
Should I infer from this that storing a PickleSerialized reference to a RedisPublisher object is a bad idea?
Firstly, thanks for DWR, it's awesome and is exactly what I needed :)
I'm looking for a hint which will hopefully clarify the docs and examples a bit. I have a "landing page" view in my Django app, where users are taken after successful login. This "PortalView" displays the users' available objects (where the objects are arbitrary custom Python models), and is obviously where I want to start my RedisPublisher (for subscribe-user). The use of DWR here is to provide updates to the states of each object in the client portal when changes take place to them.
Effectively what I want is something like this:
example views.py:
Though obviously the reference "rp" is not in scope for either someView() or otherView().
So my question is: what's the best way to ensure the availability of the RedisPublisher reference? How do people do this? Is it best to serialize the reference and save it as session data? Perhaps pickled as described here: https://docs.djangoproject.com/en/1.8/topics/http/sessions/#django.contrib.sessions.serializers.PickleSerializer
Any opinions or suggestions warmly received! Cheers, Dan