Closed
Description
Note: for support questions, please use one of these channels: stackoverflow or slack
You want to:
- report a bug
- request a feature
Current behaviour
The WebSocket server does not compress data.
Steps to reproduce (if the current behaviour is a bug)
Run the following test case
'use strict';
const eioc = require('engine.io-client');
const eio = require('engine.io');
const http = require('http');
const server = http.createServer();
const engine = eio.attach(server, {
perMessageDeflate: { threshold: 0 }
});
engine.on('connection', (socket) => {
socket.on('message', (data) => socket.send(data));
});
server.listen(3000, () => {
const socket = eioc('http://localhost:3000', {
perMessageDeflate: { threshold: 0 },
transports: ['websocket']
});
socket.on('open', () => {
socket.send('Hello');
socket.transport.ws._socket.once('data', (data) => {
console.log(data);
// => <Buffer 81 06 34 48 65 6c 6c 6f>
// an uncompressed WebSocket text frame
});
});
});
Expected behaviour
The received WebSocket frame should be compressed.
Setup
- OS: macOS
- browser: -
- engine.io version: 2.0.0
Other information (e.g. stacktraces, related issues, suggestions how to fix)
The issue seems to be caused by uws
which apparently does not compress the data despite having been instructed to do so. The above example works as expected with engine.io@1.8.x
.
Metadata
Metadata
Assignees
Labels
No labels