Client left room before receiving session id

Hi everyone,
From time to time and very random I'm getting:
colyseus.js: client left room before receiving session id.
It's really weird, everything works 8 or even 9 of 10 times, and suddenly... crashes...

I'm assigning the game client into a global variable:
window.gameClient = new Colyseus.Client(location.protocol.replace('http', 'ws')+host+(location.port ? ':'+location.port : ''));

And then on document ready, when the user submit the form I try to join the first room:
window.gameClient = new Colyseus.Client(location.protocol.replace('http', 'ws')+host+(location.port ? ':'+location.port : ''));

You can see the code here:
https://github.com/damian-pastorini/dwdgame/blob/dwdgame-master/client/client.js

Any ideas why it could be happening?

Thanks!

If anyone has this issue and you are trying to use multiple join / left rooms like I was doing, make sure to always be joined in one room.
In my case I was leaving one room before join the next one, so I moved the oldroom.leave() action inside the newroom.onJoin() and now everything works fine.
Note, this was happening randomly at the beginning until I overloaded the room onInit with data, then I got the issue all the time because the second room was delayed on load.
Best,