File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @solid-primitives/websocket " : minor
3+ ---
4+
5+ bugfix: setup heartbeat after reconnect
Original file line number Diff line number Diff line change @@ -195,12 +195,13 @@ export const makeHeartbeatWS = (
195195 clearTimers ( ) ;
196196 pongtimer = setTimeout ( ws . reconnect , options . wait || 1500 ) ;
197197 } ;
198- ws . addEventListener ( "close" , clearTimers ) ;
199198 const receiveMessage = ( ) => {
200199 clearTimers ( ) ;
201200 pingtimer = setTimeout ( ( ) => ws . send ( options . message || "ping" ) , options . interval || 1000 ) ;
202201 } ;
202+ ws . addEventListener ( "close" , clearTimers ) ;
203203 ws . addEventListener ( "message" , receiveMessage ) ;
204- setTimeout ( receiveMessage , options . interval || 1000 ) ;
204+ ws . addEventListener ( "open" , ( ) => setTimeout ( receiveMessage , options . interval || 1000 ) ) ;
205205 return ws ;
206206} ;
207+
You can’t perform that action at this time.
0 commit comments