If MWI drops it's WebSocket connection (e.g. by server restart or by calling gameWebsocket.closeConnection()) then it will create a new socket instead of reopening the old one. This obviously then causes MooLite to stop working as intended because we no longer receive any server updates.
When this change is applied, we will check if the MooLite socket is still the same as the socket that MWI is using, and if it's not then we'll reconnect and resubscribe. The check is happening in the tick handler so it shouldn't be a big performance impact.
Testing instructions
Open the XP tracker plugin
Start milking cows
Observe the tracker increasing your milking xp
Open console and run gameWebsocket.closeConnection()
You should get the Attempting to connect screen, followed by MWI reloading
Observe the XP tracker is still counting (without this commit, it will not resume after disconnecting)
Overview
https://github.com/Ishadijcks/MooLite/issues/86
If MWI drops it's WebSocket connection (e.g. by server restart or by calling
gameWebsocket.closeConnection()
) then it will create a new socket instead of reopening the old one. This obviously then causes MooLite to stop working as intended because we no longer receive any server updates.When this change is applied, we will check if the MooLite socket is still the same as the socket that MWI is using, and if it's not then we'll reconnect and resubscribe. The check is happening in the tick handler so it shouldn't be a big performance impact.
Testing instructions
gameWebsocket.closeConnection()
Attempting to connect
screen, followed by MWI reloading