Does socket.io really compress the payload?

Viewed 777

I am learning about the feature compression of socket.io. This is my source code server.(I used socket.io 2.2.0)

var app = require('express')();
var bodyParser = require('body-parser');
app.use(bodyParser.json());
var http = require('http').Server(app);
var io = require('socket.io')(http, { pingTimeout: 60000, perMessageDeflate: false });
app.use(require('express').static('public'))
http.listen(3001, function () {
    console.log('listening on *:3001');
});
//The packet is a object whose size is ~ 3KB
io.on('connection', function (socket) {
    socket.compress(true).emit('chat message', packet);  **// send packet with compress**
    socket.compress(false).emit('chat message', packet); **// send packet without compress**
});

When the client connects to the socket server, I see the following message frame. enter image description here

And wireshark monitor

enter image description here

I don't really understand the compression mechanism of websocket, but I feel that the package is uncompressed despite compressed.

Can someone explain this to me? Thanks

0 Answers
Related