File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,6 @@ io.on("connection", (socket) => {
4848
4949export default {
5050 port: 3000 ,
51- idleTimeout: 30 , // must be greater than the "pingInterval" option of the engine, which defaults to 25 seconds
52-
5351 ... engine .handler (),
5452};
5553```
Original file line number Diff line number Diff line change @@ -413,6 +413,8 @@ export class Server extends EventEmitter<
413413 * });
414414 */
415415 public handler ( ) {
416+ const idleTimeoutInSeconds = Math . ceil ( 2 * this . opts . pingInterval / 1000 ) ;
417+
416418 return {
417419 fetch : ( req : Request , server : Bun . Server ) => {
418420 const url = new URL ( req . url ) ;
@@ -434,7 +436,11 @@ export class Server extends EventEmitter<
434436 close : ( ws : BunWebSocket , code : number , message : string ) => {
435437 this . onWebSocketClose ( ws , code , message ) ;
436438 } ,
439+ maxPayloadLength : this . opts . maxHttpBufferSize ,
437440 } ,
441+
442+ idleTimeout : idleTimeoutInSeconds ,
443+ maxRequestBodySize : this . opts . maxHttpBufferSize ,
438444 } ;
439445 }
440446}
You can’t perform that action at this time.
0 commit comments