Reputation: 4349
I use gevent-socketio library, and need to send message on post_save
...
def post_save(self, obj, created=False):
// broadcast message with data(obj) to channel
How can i do this?
EDIT:
there is this example:
from socketio.namespace import BaseNamespace
from socketio.mixins import BroadcastMixin
from socketio.sdjango import namespace
@namespace('/document')
class DocumentNamespace(BaseNamespace, BroadcastMixin):
def recv_connect(self):
print "CONNECTED"
def on_join(self, msg):
self.broadcast_event('poruka', msg)
print 'JOIN'
return True
def broadcast_msg(self, channel, msg):
self.broadcast_event(channel, msg)
this example listen when client connect or send message to server,
but i need to broadcast on my method post_save
to client..
Upvotes: 0
Views: 369