Skip to content
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

[Enhancement] Use binary messages for websocket transfer #322

Open
bt90 opened this issue Aug 18, 2024 · 1 comment
Open

[Enhancement] Use binary messages for websocket transfer #322

bt90 opened this issue Aug 18, 2024 · 1 comment
Labels
enhancement New feature or request transfer

Comments

@bt90
Copy link

bt90 commented Aug 18, 2024

@schlagmichdoch I took a look at the current codebase and apparently the websocket transfer uses base64 encoded content to be transferable as a single JSON message. Would it be possible to split this? e.g. send the control message as JSON and then send the data as a binary message?

The reason I ask is because base64 adds 33% overhead for each file.

Originally posted by @bt90 in #228 (comment)

This was the easiest way to implement the websocket fallback as each message must also include the addressee to be able to relay it. Probably there are other optimized methods than sending it encoded as text. I also think all peer to peer communication should be at least transport encrypted as with WebRTC transfers but this too is not implemented yet. (See this comment and the following)

Originally posted by @schlagmichdoch in #228 (comment)


Follow up issue for #228 (comment)

Maybe we could switch from JSON to protobuf? That would keep things together as a single message, while avoiding the overhead of base64.

@bt90 bt90 added the enhancement New feature or request label Aug 18, 2024
@schlagmichdoch
Copy link
Owner

Something like protobuf would probably be the cleanest, thanks for the suggestion! Alternatively we could bundle up our own protocol by defining something like:

  • first 36bytes: uuid
  • next 4 bytes chunkid
  • everything that follows: data

I think it's also possible to convert json containing ArrayBuffers into raw data and send that.
I would definitely need to do some research first.

I'm a little short on time right now so I this will probably only be implemented in v2.1 as I want to finish everything listed here first (#267)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request transfer
Projects
None yet
Development

No branches or pull requests

2 participants