posting a message to server from external process #885
-
Hello, As I debug this stuff, I can see the messages getting sent to the redis pubsub system, on the channel 'flask-socketio' Now, I would like to also send messages from a Node JS service and I don't see an equivalent in node, so I am trying to send messages directly to the redis pubsub channel. however if I just copy a previous message and re-publish, the client(s) don't get it. My question is: is there a way to directly send messages to redis pubsub to be picked up by the python subscribing process? Thanks for help. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can also use JSON for the data, you do not need to implement the pickle encoding in your Node application. You can see an example of what the JSON object must contain here: https://github.com/miguelgrinberg/python-socketio/blob/main/src/socketio/pubsub_manager.py#L116-L120. |
Beta Was this translation helpful? Give feedback.
-
@miguelgrinberg I ended up with:
and that worked! |
Beta Was this translation helpful? Give feedback.
@miguelgrinberg
Thanks for the quick reply, and thanks for the tip on using JSON.
I thought things had to be pickled because that's what the redis-manager does, but indeed after reviewing the listen code, I see it tries multiple methods, including json.loads.
I ended up with:
and that worked!