colyseus.js icon indicating copy to clipboard operation
colyseus.js copied to clipboard

Cannot broadcast empty typed messages

Open Erfa opened this issue 3 years ago • 0 comments

It seems like empty typed messages are not supported. I tried doing this:

class ExampleMessage extends Schema {}

And then in the room:

this.broadcast(new ExampleMessage())

This fails with this error:

Starting at colyseus >= 0.13 You must provide a type and message when calling `this.broadcast()` or `client.send()`. Please see: https://docs.colyseus.io/migrating/0.13/
Error: an instance of Schema was expected, but {} has been provided.

If I just add a dummy field on the message class it works fine.

Erfa avatar Mar 03 '21 20:03 Erfa