jamescarterbell / bevy_eventwork

An event based networking library for Bevy
Other
49 stars 6 forks source link

Sending messages from JavaScript #15

Open davi4046 opened 2 months ago

davi4046 commented 2 months ago

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.

NoahShomette commented 2 months ago

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