bevy_eventwork icon indicating copy to clipboard operation
bevy_eventwork copied to clipboard

Sending messages from JavaScript

Open davi4046 opened this issue 1 year ago • 1 comments

How are messages supposed to be formatted to be able to be send by JavaScript?

For example, this doesn't work:

const socket = new WebSocket('ws://localhost:8081');

const message = {
    kind: 'balls_of_steel:ChatMessage',
    data: {
        message: 'Hi Server!',
    },
};

socket.send(JSON.stringify(message))

Btw, I'm using the bevy_eventwork_mod_websockets crate. But I assume the message format is the same regardless.

davi4046 avatar Jun 29 '24 09:06 davi4046

Responded more in depth in this issue on BEMW: https://github.com/NoahShomette/bevy_eventwork_mod_websockets/issues/2#issuecomment-2198267057.

I'll try and take a look and see if its reasonable to allow eventwork/network providers to use a different serialization method

NoahShomette avatar Jun 29 '24 17:06 NoahShomette