BilliAm
BilliAm

Reputation: 589

Websocket Server connect to Django for forwarding Broadcasts

I really didn't know how to ask but, how would I setup a JavaScript SocketIO or Node socket server that would be able to accept messages from HTTP requests (Restful API)?Basically I have a Django back end, and want a SocketIO or Node server to run side by side, handling real time events fed to it through HTTP requests.

Is there anyway to send a HTTP request to the SocketIO or Node server that would the digest and send to broadcast to it's rooms? Or is this even realistic?

Upvotes: 2

Views: 1370

Answers (1)

avichalp
avichalp

Reputation: 1120

You can use Redis Pub/Sub along with your Django backend, Node server and and socket.io.

What you have to do is make your Django server listen to Http requests and publish real time events onto Redis. Also Start a Node.js server which would Subscribe to events published by your Django server on Redis. Then connect Socket.io to Node.js server to get events in real time on client side. Here is a tutorial

Upvotes: 1

Related Questions