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

increase maximum message size from 100 to 500 mb #25

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ webServer.listen(5000);
-->

## Changelog
### **WORK IN PROGRESS**
* (foxriver76) increase maximum message size from 100 MB to 500 MB

### 2.1.1 (2023-07-31)
* (bluefox) Packages updated

Expand Down
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
/* jshint -W061 */
'use strict';

const WebSocket = require('ws');
const querystring = require('querystring');
const { WebSocketServer } = require("ws");

/** Maximum message size which server accepts */
const MAX_PAYLOAD = 524_288_000;

const MESSAGE_TYPES = {
MESSAGE: 0,
Expand Down Expand Up @@ -181,7 +184,7 @@ function SocketIO (server) {

const socketsList = [];

const wss = new WebSocket.Server({
const wss = new WebSocketServer({
server,
verifyClient: function (info, done) {
if (run.length) {
Expand All @@ -208,7 +211,8 @@ function SocketIO (server) {
},
clientNoContextTakeover: true,
serverNoContextTakeover: true
}
},
maxPayload: MAX_PAYLOAD
});

wss.on('connection', (ws, request) => {
Expand Down