File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -403,7 +403,20 @@ export const eventManager = {
403
403
404
404
_ . each ( driverToSocketEvents , ( event ) => {
405
405
Cypress . on ( event , ( ...args ) => {
406
- return ws . emit ( event , ...args )
406
+ const cb = args . pop ( )
407
+
408
+ const handleDisconnect = function ( disconnectReason ) {
409
+ cb ( {
410
+ error : new Error ( disconnectReason ) ,
411
+ } )
412
+ }
413
+
414
+ ws . once ( 'disconnect' , handleDisconnect )
415
+
416
+ return ws . emit ( event , ...args , ( ...cbArgs ) => {
417
+ ws . off ( 'disconnect' , handleDisconnect )
418
+ cb ( ...cbArgs )
419
+ } )
407
420
} )
408
421
} )
409
422
Original file line number Diff line number Diff line change 1
1
import fs from 'fs'
2
+ import buffer from 'buffer'
2
3
import type http from 'http'
3
4
import server , { Server as SocketIOBaseServer , ServerOptions } from 'socket.io'
4
5
import { client } from './browser'
5
6
6
- const HUNDRED_MEGABYTES = 1e8 // 100000000
7
-
8
7
const { version } = require ( 'socket.io-client/package.json' )
9
8
const clientSource = require . resolve ( 'socket.io-client/dist/socket.io.js' )
10
9
@@ -21,7 +20,7 @@ class SocketIOServer extends SocketIOBaseServer {
21
20
// previous commit for reference:
22
21
// https://github.com/socketio/engine.io/blame/61b949259ed966ef6fc8bfd61f14d1a2ef06d319/lib/server.js#L29
23
22
opts = opts ?? { }
24
- opts . maxHttpBufferSize = opts . maxHttpBufferSize ?? HUNDRED_MEGABYTES
23
+ opts . maxHttpBufferSize = opts . maxHttpBufferSize ?? buffer . constants . MAX_LENGTH
25
24
26
25
super ( srv , opts )
27
26
}
You can’t perform that action at this time.
0 commit comments