This repository has been archived on 2023-10-03. You can view files and clone it, but cannot push or open issues or pull requests.
Files
JS-Server-Framework/bin/classes/websocket.js
steevLP d22fdadc50 Initial Comit
The Server has overcome it's early Development Steps.
although it still is a bit unstable it works in it's actual state
2019-09-25 23:53:02 +02:00

27 lines
877 B
JavaScript

function socket(WebSocket, config) {
// Websocket
const wss = new WebSocket.Server({
port: config.websocket,
perMessageDeflate: {
zlibDeflateOptions: {
// See zlib defaults.
chunkSize: 1024,
memLevel: 7,
level: 3
},
zlibInflateOptions: {
chunkSize: 10 * 1024
},
// Other options settable:
clientNoContextTakeover: true, // Defaults to negotiated value.
serverNoContextTakeover: true, // Defaults to negotiated value.
serverMaxWindowBits: 10, // Defaults to negotiated value.
// Below options specified as default values.
concurrencyLimit: 10, // Limits zlib concurrency for perf.
threshold: 1024 // Size (in bytes) below which messages
// should not be compressed.
}
});
return wss;
}
module.exports = socket;