I'm running a gevent-socketio Django application.

I have something similar to this class

@namespace('/connect')
class ConnectNamespace(BaseNamespace):

    def on_send(self, data):
        # ...

However, if I receive the events from the javascript client, everything works and for instance send event is processed correctly

I'm a little bit lost if I want to emit some event on the server side. I can do it inside the class with socket.send_packet

But now I want to link some event to post_save signal, so I'd like to send_packet from outside this namespace class, one way of doing this would be

ConnectNamespaceInstance.on_third_event('someeventname')

I just can't figure out how can I get the instance of ConnectNamespaceInstance

To sum it up, I just want to send an event to javascript client after I receive post_save signal

Edit
Report