You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Thanks to the pointers in this discussion I now have a single python script housing client factory and server websockets executing concurrently. Now on receiving a message in the server factory, I want to propogate it or send it forward to the client factory within the same script which will in turn send it to an external server. I tried declaring the objects globally:
And I tried this option client_factory.protocol.sendMessage(str("SUBSCRIBE|"+_users).encode('utf8'))
Both don't seem to work. How do I go about achieving this? Can I create custom events and then raise them in the server factory so that the callback in the client protocol is called?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi! Thanks to the pointers in this discussion I now have a single python script housing client factory and server websockets executing concurrently. Now on receiving a message in the server factory, I want to propogate it or send it forward to the client factory within the same script which will in turn send it to an external server. I tried declaring the objects globally:
and then in the
onMessage
event of the server factory, I am trying to use the reactor tosendMessage
using the client websocketreactor.callFromThread(client_factory.protocol.sendMessage(str("SUBSCRIBE|"+_users).encode('utf8')))
And I tried this option
client_factory.protocol.sendMessage(str("SUBSCRIBE|"+_users).encode('utf8'))
Both don't seem to work. How do I go about achieving this? Can I create custom events and then raise them in the server factory so that the callback in the client protocol is called?
Beta Was this translation helpful? Give feedback.
All reactions