These are chat archives for fanout/pushpin

25th
Nov 2015
Vipul
@v1p
Nov 25 2015 14:22
Um Hi again :sweat_smile: , I am having a slight issue in understanding how wsh work with pushpin
posted an issue on github fanout/websockhop#7
'opened' event is executed almost every time (I believe wsh is trying to do ping in that case, but not able to understand the behavior here)
I am doing a pub-sub over websockets with pushpin/websockhop
so with every 'opened' event, am I supposed to send 'subscribe' request ?
that creates problem of it's own, i.e. subscribing from same client many times
Vipul
@v1p
Nov 25 2015 14:27
Pointers to understand this flow is greatly appreciated. Right now going through the readme of websockhop again
Justin Karneges
@jkarneges
Nov 25 2015 19:01
are you able to see what your browser is doing with websockets? in your browser's dev tools you should see the websocket connecting being established with status code 101
some browsers (like chrome and recent firefox) will even show you the messages sent over the connection
the 'opened' event is triggered once the connection is established. if you're seeing this event multiple times, then likely the websocket is being disconnected/reconnected. this would be reflected in the dev tools as many websocket connections. please confirm if that's the case
and yes, the idea is that you write your connection initialization code in the 'opened' handler, so that it is re-executed every time the connection reconnects (which is handled automatically for you)
this should not result in the client being subscribed multiple times because if 'opened' is called again, then it means the previous connection (and associated subscriptions) are gone