0

Before I post my question, I understand that the HTTP protocol is a typical PULL protocol and Django doesn't work too well with the PUSH mechanism that I'm looking for. So what I plan to do is create a node server which can push notifications to a client browser.

Since I have complete control over the architecture, I don't mind creating the separate node server to handle notifications. I'm planning to create a webhook on the node end which will be consumed by a urllib2 request from my Django server which will have the necessary data to be pushed.

My question here is, is it possible to do this? If so, can the client browser use socket.io and connect to this node server separately?

Newtt
  • 6,050
  • 13
  • 68
  • 106
  • Why don't you give https://github.com/jonashagstedt/swampdragon a try? It works pretty well. It uses tornado+redis. – argaen Jul 10 '15 at 08:16
  • @argaen I had gone through this. My worry here is, most of my Django architecture is already present. I'm not sure if swampdragon can just be plugged into existing models and used from there. EDIT: scrap that. I'll have a look. Thanks! :) – Newtt Jul 10 '15 at 08:18
  • It is similar to django rest framework. You can just plug in the functionality without modifying your project structure =). – argaen Jul 10 '15 at 08:31

1 Answers1

0

Yes, that would be possible. See Web sockets make ajax/CORS obsolete? for the second part of the question.

Community
  • 1
  • 1
Klaus D.
  • 13,874
  • 5
  • 41
  • 48
  • Awesome! Is there any way I can send to only a particular user using this architecture? I've worked with Django extensively but I'm still relatively new to Node. So I wouldn't know how to push a notif only to the relevant user. – Newtt Jul 10 '15 at 08:13
  • You have to include the information in the notification call from Django to node.js. Also you need some kind of authentication against node.js. – Klaus D. Jul 10 '15 at 08:39