Newtt
Newtt

Reputation: 6190

Push notification to specific web client in Django

For this question, I don't have any code samples as I don't know where to start.

How do I make use of Django and Node to push notifications only to a specific web client?

For example, user A performs an activity. For confirmation of said activity, I'd like to push a notification to only that user or client. Can someone point me to the correct resources I can use to build such a system?

EDIT Current Architecture of app

Server: Django Rest Framework Front end: AngularJS

Planning to use Node for notifications. Only part I'm confused about is sending it to a specific user. What's to stop all users getting a notification that's meant for only one user.

Upvotes: 5

Views: 2434

Answers (2)

xleon
xleon

Reputation: 6365

From all those packages mentioned by @GwynBleidD I think the best option would be http://swampdragon.net/

But all of those come with the problem that you need to implement it yourself, even re-architecting your application in some cases.

If you are looking for something easier I would take a look at https://pusher.com/ You can send messages to a particular client easily with python and handle that message with javascript on the client side. That´s only one of the array of things you can do.

Upvotes: 0

GwynBleidD
GwynBleidD

Reputation: 20539

If we are saying about web clients (browsers), it is only achievable using websockets or some technology relying on Java (not Javascript) or Flash.

I'm assuming that you want to avoid Java and Flash, so only solution here are websockets.

To understand it properly: there is no such thing like pure PUSH notification (by pure push I mean server is establishing connection with client, not other way). There is always connection from client to server. But using websockets connection can be persistent so You can send from server notification to client every time. That means: for every client there will be persistent connection that will stress your server in some way. Keep that in mind.

There are some packets for django, ready to use, that will allow you to create websocket servers. For some of them you will need supporting web server (Nginx for example) and wsgi server (uWSGI for example).

Upvotes: 1

Related Questions