-
We're looking at possibly migrating mobile app clients over to using server sent events instead of websockets due to issues with websockets dropping out when changing connections, etc. We need to be able to send customised data to individual event streams at unpredictable intervals (based on when records in the database have been updated). Currently we're using 0.14 we are iterating through the uWebsocket's list of sockets and using the perSocketUserData containing the uuid for the session so we can match up the correct socket for the correct session, and in updating to v20.8.0 (update in progress) we can instead publish to a websocket topic with each user session having a unique topic id in order to send the data update to the particular sockets who need to receive it. Both methods avoid the problem that the uWebsockets manual explicitly warns against with holding pointers for websockets in a map or similar outside of the uWebsockets library. I'm currently assuming that the same problems with holding pointers for websockets that may be cancelled/aborted in the library at any time would apply to the http responses for event streams as well, which means that we should not store the response separately in a map with uuid index. Is there a way to find a particular open/ongoing http response for an event stream in order to send an event to the individual user(s) that need that data? Can we attach an id to an http response so we can identify the correct response to send information to? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
If you need a map then use a map |
Beta Was this translation helpful? Give feedback.
If you need a map then use a map