Sunday 15 June 2014

websocket - Live notification/chat in django -



websocket - Live notification/chat in django -

i making website django , want implement live notification feature 1 on facebook or se.

i did research , seems although there's 2 options: ajax long polling , websockets, latter way go.

however, know go plugin websocket 'socket.io' turns out node.js plugin , django port seems back upwards python 2 , project seems pretty much dead. using python 2.7 project interpreter want future proof myself if upgrade python3 later, don't find myself not beingness able utilize functionality.

so question this: there straight forwards , future ready way implement websocket used send live notifications , chats in django env?

django build in blocking manner, i.e. synchronous approach. so, cannot open persistent websocket django app, block entire django thread.

if want enable notification/chat within django project environment, recommend utilize centrifuge. written in python, async (non-blocking) framework used: tornado.

but, don't need know how works, provides simple rest api communicate it.

simplified workflow, check docs more details:

start centrifuge @ same server, django project (or on low latency between them) your front-end open websocket centrifuge, not django project. when need send notification, send centrifuge django via rest api, , centrifuge deliver needed clients!

i've tried , works!

django websocket

No comments:

Post a Comment