-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle binary data #106
Comments
Yeah, agree. I also thought I'd look into using msgpack. This is my (very rough impression, and perhaps also wrong (?), list of pros and cons). jsonPros
cons
bincodePros
Cons
msgpackPros
Cons
|
It may be worth either having a set of pick-one-of feature flags for serialisation (e..g., 'json', 'bincode' or 'msgpack') or operating a bring your own serialiser model and supplying a few common ones. The trade off between serialisation speed, serialisation speed & message size is going to depend on the network topology and data size, whilst json may be nice for debugging |
Yes, assuming it won't add too much complexity, I think feature flags would be a good idea. One downside is that you now have to take care that the server and peers is configured in a compatible way (i.e. potential footgun if you only configure the socket side), or have the server support multiple formats (more bloated protocol and implementation). We should at least take care that we produce some meaningful error that will put people on the right track. Perhaps it would make sense to default to msgpack in the cli and socket, and then leave the other formats as feature flags for more advanced users? Also, I think I like the bring-your-own serializer idea, as long as we can keep it optional for less advanced users... So I guess we could probably do both? A |
re: binary data - bincode-org/bincode#629 (comment) Seems like bincode is wasm compat. Does that make it the top contender? Also, re "need to make sure client and server is using the same version of bincode" - i'm not sure that's an issue? Since we have the same problem for serde_json. I'd assume matching those versions is up to the user and how they want their clients to update. |
Seems like a solid contender, though kind of wondering if this is premature optimisation, how much does serialising to json cost us when it's just for signalling? |
I guess it's a good topic to discuses. Do we want to do this at all? I am fine with closing this as a "won't do." or as a very low priority task to eventually do. |
Feel like we should first write some benchmarks? And see what we determine from there. I've noticed that establishing a connection can take quite a while on Wasm, but don't know why |
Noticed that too, but I figured that was just JavaScript being JavaScript. |
iirc, even though we implement ice trickle, there is a theoretically unnecessary wait for ice completion in there. However, in practice nat hole punching doesn't work if we remove it. I'm not sure what that's about, though. Made an issue to track it: #192 |
Not the same thing i think. Json will always be json, so it doesn't matter if the client is on another version or not, could even be another language. Unless I'm misunderstanding something. Bincode needs to be on the same major version and "use the same configuration" or you might not be able to deserialize. Not sure what configuration means exactly. See faq in bincode readme. |
Currently there's no handler for binary data, but it could be added quite trivially with bincode. I think this is an easy-win.
matchbox/matchbox_socket/src/webrtc_socket/native/signalling_loop.rs
Line 42 in c9d10cb
The text was updated successfully, but these errors were encountered: