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

Relay Websocket: Use permessage-deflate extension #1549

Closed
JeremyMahieu opened this issue Aug 2, 2020 · 3 comments
Closed

Relay Websocket: Use permessage-deflate extension #1549

JeremyMahieu opened this issue Aug 2, 2020 · 3 comments
Assignees
Labels
feature New feature request
Milestone

Comments

@JeremyMahieu
Copy link

JeremyMahieu commented Aug 2, 2020

Feature description

Instead of manually applying zlib, consider adding support for permessage-deflate websocket extension. Which is by default used in webbrowsers.

  1. Clients sets the Sec-WebSocket-Extensions: permessage-deflate; header for the websocket, browsers already do this
  2. Server (weechat) also sets the Sec-WebSocket-Extensions: permessage-deflate; header
  3. Server implements the compression and decompression: some sample in C

What does this impove:

  • Websocket now has compression in both directions. Before it was only in the server -> client direction.
  • Messages can be read in the dev console of the browser even with compression applied, very important for debugging
  • Clients can leave out extra libraries such as zlib's inflate.js and a bunch of code to facilitate this compression and let the browser handle it.
  • Perfectly backwards and forwards compattible: If the server does not set the header, there is no problem, it just won't be compressed, so backwards compatibility is fine. New clients will work with old weechat. In the other direction, because of the headers in the binary files, they will see it's uncompressed and it will also keep working. Or you could keep the zlib implementation server side and new clients would always choose compression=off.
@flashcode
Copy link
Member

flashcode commented Jan 14, 2024

Hi,

First implementation is available in this development branch (target version is WeeChat 4.3.0, with a new api relay protocol): https://github.com/weechat/weechat/tree/relay-api

Extension permessage-deflate works for both weechat and api protocols.

@flashcode flashcode self-assigned this Jan 14, 2024
@flashcode flashcode added the in progress Someone is working on this issue label Jan 14, 2024
@flashcode flashcode added this to the 4.3.0 milestone Jan 14, 2024
@JeremyMahieu
Copy link
Author

Amazing, thanks for your effort.

@flashcode
Copy link
Member

I forgot to mention here, this has been implemented while adding a new "api" relay (HTTP REST API), which was designed to fix the design of "weechat" protocol (permessage-deflate is supported in both), see: #2066.

API protocol is under development, and when finished, it should deprecate completely the "weechat" protocol.

@flashcode flashcode removed the in progress Someone is working on this issue label Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

2 participants