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

Usage with websockets-extensions #49

Open
Legogris opened this issue Jan 21, 2019 · 1 comment
Open

Usage with websockets-extensions #49

Legogris opened this issue Jan 21, 2019 · 1 comment

Comments

@Legogris
Copy link

I am trying to add support for permessage-deflate to do compression of messages sent from server to client.
There is an implementation in https://github.com/faye/permessage-deflate-node for https://github.com/faye/websocket-extensions-ruby.

However, I can not figure out what the appropriate way to add the extensions are. There is some discussion here, but no details on how/if it's possible to get this to work at this time: faye/faye-websocket-ruby#87

@boazsegev
Copy link
Owner

Hi @Legogris ,

Thank you so much for your interest in iodine and your wish to improve it!

facil.io, which is iodine's engine, doesn't support the permessage-deflate header just yet, though it should be possible to add support.

I do want to support it at some point, but:

  1. I'm not sure that's wise (compression weakens TLS security in HTTP, I'm not sure how it would effect security over WebSocket connections).

  2. I'm not sure the extra CPU load is worth the trouble.

This means that supporting the permessage-deflate extension could only be achieved by authoring your own WebSocket protocol layer (using raw TCP/IP upgrades) or messing around in iodine's C layer code (or, more precisely, the facil.io layer).

I already thought about it a bit, and it shouldn't be that difficult (the deflate functionality might be the hardest part, since it requires a library).

If updating the C layer code, one would need to compress the message and than set the appropriate rsv flags. I guess the code would fit here.

However, not all clients support permessage-deflate, so a flag indicating support would be required, possibly added here.

If authoring a Ruby protocol, using raw TCP/IP upgrades with an "upgrade.tcp" handler, than it becomes a ruby world concern, which might make coding easier while slowing up the connection's performance (since parsing will be performed in the Ruby GIL).

Thanks again for opening this issue!

Kindly,
Bo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants