Keeping connection open in Django without websockets
Asked Answered
D

1

1

I have a mini computer that does not support websockets that I would like to receive push notifications from a server.

The issue is that after the client connects to the server, the server responds and then closes the connection. This makes it so the client has to continually reconnect to the server to get new information.

Is there a way using Django to allow the connection to be left open and then have the server publish data to the client?

Disturbing answered 27/8, 2012 at 17:20 Comment(0)
U
4

Django is primarily a request/response framework and as such does not have support for real duplex communication.

Socket.IO is the de facto library that makes websocket-like functionality cross-browser (IE5.5+), using real websockets as a transport if the browser allows it, falling back to HTTP long-polling or whatever else if it doesn't. For various options on integrating Socket.IO with Django, read this.

Underhanded answered 27/8, 2012 at 17:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.