Multiple websocket connection vs single websocket connection when using django channels

2,157 views
Skip to first unread message

Robin Lery

unread,
Apr 6, 2018, 5:10:41 AM4/6/18
to django...@googlegroups.com
Hi,

Suppose an application has features like Chat, Notification and Activity feeds. 

I would like to know whether its recommended to have different   websocket connection for different  feautues for each user. Meaning for chat purpose a separate socket connection, for notification another separate connection?

Or is it better to have only one websocket connection for a user, and work around that single connection for different features?

Sincerely,
Robin 

James Farris

unread,
Apr 6, 2018, 12:04:39 PM4/6/18
to Django users
I’m looking into creating an app that may utilize chat and notifications as well. I’m interested in what others have to say about this as well

Ken Whitesell

unread,
Apr 6, 2018, 12:19:48 PM4/6/18
to Django users
Hi Robin,

I can't speak to any generalized situations, or what might be considered "best practices" or most optimal.

What I can say is that we have gone with the single websocket connection for each client - whether it's a real person at a browser or an application. All our communications through the channel are JSON objects, and we include a key named "app" in the object which identifies the specific "feature" or "application" to which a message is directed. It's done in both directions - submissions through the channel from the browsers to the server and from the server to the browser all have that key in the JSON. 

About the most I can say is that it works well for us. 

Ken

Robin Lery

unread,
Apr 8, 2018, 1:55:30 AM4/8/18
to django...@googlegroups.com
Yes, I guess that's how to work around per connection for a user. Thank you for your input!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0bf0d083-1bb3-4963-905c-9e8bfce6c765%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages