v19.3.0 update-related queston #1282
-
First of all, I would like to say thank you for implementing and open-sourcing uWebSockets! - it is one of the most elegant projects I have seen (my only wish is that it could work on bare hardware, especially when QUIC is implemented :) To evaluate uWebSockets I implemented a small rpc server badware in node with an aim to port it to c++ when all works. The client badware is in browser. The rpc server uses publish() to multicast to all clients - including self. Everything worked as expected until v19.3.0 that stopped publishing to self, which broke my badware logic. Would there be some flag to re-enable "publish to self" or the right way is to use send() right after publish()? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
v19.0 added app.publish and made ws.publish not publish to self. v19.3 fixed bug where ws.publish incorrectly published to self #1269 (comment) Sounds like you were using ws.publish but in v19 you need to use app.publish, see example: https://github.com/uNetworking/uWebSockets/blob/master/examples/Broadcast.cpp#L73 |
Beta Was this translation helpful? Give feedback.
-
Hahaha that strip.. Yes app.publish does what you want |
Beta Was this translation helpful? Give feedback.
-
@hst-m and @alexhultman, thank you for answering - app.publish() works with "publish to self"! Broadcast.cpp is using app variable before app.run(). Looks like the node interface does not provide app.run(), so attaching app to ws object in ws.open handler. From Broadcast.cpp, seems that it worth diving into uSockets when codding uWS in C++... |
Beta Was this translation helpful? Give feedback.
v19.0 added app.publish and made ws.publish not publish to self. v19.3 fixed bug where ws.publish incorrectly published to self #1269 (comment) Sounds like you were using ws.publish but in v19 you need to use app.publish, see example: https://github.com/uNetworking/uWebSockets/blob/master/examples/Broadcast.cpp#L73