crossws icon indicating copy to clipboard operation
crossws copied to clipboard

Enable permessage-deflate to have websocket compression

Open Yasso9 opened this issue 1 year ago • 1 comments

Describe the feature

Hi, first thanks to this very cool library and the integration with nitro and nuxt.

Is it possible to have Sec-WebSocket-Extensions: permessage-deflate when answering a client connection ? Currently it does not respond to enabling permessage-deflate when the client ask to like on this one :

Screenshot from 2024-03-01 12-03-42

I have Sec-WebSocket-Extensions: permessage-deflate on the request header but nothing on the response header.

Additional information

  • [ ] Would you be willing to help implement this feature?

Yasso9 avatar Mar 01 '24 11:03 Yasso9

Is having this sufficient inside the defineWebSocketHandler object ?

upgrade(req) {
  return {
    headers: {
      "sec-websocket-extensions": "permessage-deflate",
    },
  };
},

Yasso9 avatar Mar 01 '24 13:03 Yasso9

Closing assuming setting headers would be enough. i couldn't find any cross platform API for it also.

pi0 avatar Aug 06 '24 16:08 pi0