Why can't I join the room through room id? (SOLVED)

3 Jun 2018, 08:42

Why can't I join the room through room id?

3 Jun 2018, 16:54

Hi @samael65535, you should be able to do that. Can you provide more details like your room handler (requestJoin method) and the colyseus versions you're using?

Cheers

4 Jun 2018, 13:57

One more question, When I use the client in Electron, the message is not correct

var message = msgpack.decode(new Uint8Array(event.data)); 
4 Jun 2018, 14:00

0_1528120792387_28fd6720-01fc-4095-a7d3-a0ee31f8aaa3-image.png

5 Jun 2018, 20:25

This is really weird indeed. It looks like an issue with notepack.io decoder. I've just created an issue in their repository: https://github.com/darrachequesne/notepack/issues/17

I'll try to debug that in the meantime.

6 Jun 2018, 02:54

Hi @samael65535,

I finally understood why this is happening, still don't know how to fix it though.

  • As notepack.io has a browser-specific version for browsers specified on its package.json (see), it decodes the messages properly in the browser environment.
  • When running inside Electron, it will load the Node.js version, not the browser one
  • The colyseus.js client converts the incoming data to array via new Uint8Array(event.data), which can't be properly decoded in the Node.js version of the decoder.

Maybe you can fix this temporarily by replacing the lib/* files under node_modules/notepack.io with the ones located on browser/*. Of course this is not a definitive solution.

6 Jun 2018, 04:33

OK, I'll try

6 Jun 2018, 21:16

Hey @samael65535, I've managed to fix this by forcing the client to always use the browser version of notepack.io. It's fixed on latest version (colyseus.js@^0.9.7).

Thanks a lot for reporting and providing your example!

7 Jun 2018, 11:04

Thanks :smile: