Jawa-the-Hutt
Explore posts from serversWebsocket topic publish doesn't work until you refresh the page
thanks for the info and thanks for taking time to look at this. FWIW, I tagged you in the original message not to get your specific help, but to call out the fact you originated the example at stackblitz. So again...thanks for looking at this.
ultimately I'm not doing a chat room. Was just using the chat example that's in all the documentation. I guess the
.publish
in the chat example would be akin to DM'ing another user directly via some sort of shared topic that included each peer's id.
Where I'm going with the websockets is I need to be able to broadcast to a group of users who have subscribed to certain topics or even be able to broadcast to a specific peer that is subscribed to a topic that is based on the peer.id. Unless I've misunderstood some things, .send
is not going to be able to do that.16 replies
Websocket topic publish doesn't work until you refresh the page
have figured out to make it work without the page refresh, but don't like it. really think this is bug in the underlying websocket implementation, but that's a complete guess on my part.
so...server side, something like above, but I go ahead and
clearInterval
on the close
.
client side, you open the connection, then close it and then open it again. so something like this:
16 replies
Websocket topic publish doesn't work until you refresh the page
Ultimately, I'm going a slightly different direction instead of having a watcher inside the
open
, I'm sending all the peers to the unstorage
memory driver so that I can access the peers from anywhere else I need server side.
this inside the open
then something like this function when I want to send something out
16 replies