playsocketjs 5.2.1 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -282,6 +282,7 @@ new PlaySocketServer(options?: PlaySocketServerOptions)
|
|
|
282
282
|
| `path` | `string` | No | "/" | WebSocket endpoint path. |
|
|
283
283
|
| `server` | `http.Server` | No | - | Existing http server. |
|
|
284
284
|
| `rateLimit` | `number` | No | 20 | Messages/second rate limit. |
|
|
285
|
+
| `maxPayload` | `number` | No | 6291456 | Max. size of a single incoming message in bytes. |
|
|
285
286
|
| `debug` | `boolean` | No | false | Enable debug logging. |
|
|
286
287
|
| `verifyClient` | `function` | No | - | Callback to verify connections before WebSocket upgrade. |
|
|
287
288
|
|
package/package.json
CHANGED
package/src/server/server.js
CHANGED
|
@@ -88,10 +88,11 @@ export default class PlaySocketServer {
|
|
|
88
88
|
* @param {string} [options.path='/'] - WebSocket endpoint path
|
|
89
89
|
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
90
90
|
* @param {number} [options.rateLimit=20] - Maximum number of operations per second per client
|
|
91
|
+
* @param {number} [options.maxPayload=6291456] - Maximum size of a single incoming message in bytes
|
|
91
92
|
* @param {import("ws").ServerOptions["verifyClient"]} [options.verifyClient] - Optional callback to verify client connections before upgrade. Receives (info, callback) where info contains { req, origin } and callback is (verified, code?, message?) => void
|
|
92
93
|
*/
|
|
93
94
|
constructor(options = {}) {
|
|
94
|
-
const { server, port = 3000, path = "/", debug = false, rateLimit = 20, verifyClient } = options;
|
|
95
|
+
const { server, port = 3000, path = "/", debug = false, rateLimit = 20, maxPayload = 6 * 1024 * 1024, verifyClient } = options;
|
|
95
96
|
|
|
96
97
|
if (debug) this.#debug = true; // Enable extra logging
|
|
97
98
|
|
|
@@ -112,6 +113,7 @@ export default class PlaySocketServer {
|
|
|
112
113
|
this.#wss = new WebSocketServer({
|
|
113
114
|
server: this.#server,
|
|
114
115
|
path,
|
|
116
|
+
maxPayload,
|
|
115
117
|
...(verifyClient && { verifyClient })
|
|
116
118
|
});
|
|
117
119
|
|
package/types/server/server.d.ts
CHANGED
|
@@ -114,6 +114,7 @@ export default class PlaySocketServer {
|
|
|
114
114
|
* @param {string} [options.path='/'] - WebSocket endpoint path
|
|
115
115
|
* @param {boolean} [options.debug=false] - Enable debug logging
|
|
116
116
|
* @param {number} [options.rateLimit=20] - Maximum number of operations per second per client
|
|
117
|
+
* @param {number} [options.maxPayload=6291456] - Maximum size of a single incoming message in bytes
|
|
117
118
|
* @param {import("ws").ServerOptions["verifyClient"]} [options.verifyClient] - Optional callback to verify client connections before upgrade. Receives (info, callback) where info contains { req, origin } and callback is (verified, code?, message?) => void
|
|
118
119
|
*/
|
|
119
120
|
constructor(options?: {
|
|
@@ -122,6 +123,7 @@ export default class PlaySocketServer {
|
|
|
122
123
|
path?: string;
|
|
123
124
|
debug?: boolean;
|
|
124
125
|
rateLimit?: number;
|
|
126
|
+
maxPayload?: number;
|
|
125
127
|
verifyClient?: import("ws").ServerOptions["verifyClient"];
|
|
126
128
|
});
|
|
127
129
|
/**
|