GitHub Documentation Patreon donate button

Room.onLeave() do not call on connection lost.



  • When I close client in unexpected way or disable network (like turn on airplane mode on phone) and connetction lost whithout call 'room.Leave()' from client side - the server side room have open client forever ('room.onLeave' do not call and 'room.clients.length' do not change). Any way to handle this?



  • May try to track through room.onStateChange, i.e.
    create on the server in a state, let's say the variable MyConnect: true when called

    room.onStateChange((state) => {
    				if (state.MyConnect != true) {
    				 // Do something ...
    				}
                });
    

    If the connection is terminated, then state.MyConnect will be undefined, which means it will not equal true


 

GitHub Documentation Patreon donate button

© 2019 Endel Dreyer