File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
packages/app/src/app/overmind/effects/live Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ type Options = {
3636
3737type JoinChannelResponse = {
3838 liveUserId : string ;
39+ reconnectToken : string ;
3940 roomInfo : RoomInfo ;
4041} ;
4142
@@ -269,6 +270,16 @@ class Live {
269270 . join ( )
270271 . receive ( 'ok' , resp => {
271272 const result = camelizeKeys ( resp ) as JoinChannelResponse ;
273+
274+ // We rewrite what our reconnect params are by adding the reconnect token.
275+ // This token makes sure that you can retain state between reconnects and restarts
276+ // from the server
277+ // @ts -ignore
278+ this . channel . joinPush . payload = ( ) => ( {
279+ version : 2 ,
280+ reconnect_token : result . reconnectToken ,
281+ } ) ;
282+
272283 resolve ( result ) ;
273284 } )
274285 . receive ( 'error' , resp => reject ( camelizeKeys ( resp ) ) ) ;
You can’t perform that action at this time.
0 commit comments