Why can't I join the room through room id? (SOLVED)
-
Why can't I join the room through room id?
-
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
-
One more question, When I use the client in Electron, the message is not correct
var message = msgpack.decode(new Uint8Array(event.data));
-
-
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/17I'll try to debug that in the meantime.
-
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 itspackage.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 vianew 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 undernode_modules/notepack.io
with the ones located onbrowser/*
. Of course this is not a definitive solution.
- As
-
OK, I'll try
-
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!
-
Thanks :smile: