File tree Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ export const register = async (
155
155
156
156
const wsErrorHandler : express . ErrorRequestHandler = async ( err , req ) => {
157
157
logger . error ( `${ err . message } ${ err . stack } ` )
158
- ; ( req as WebsocketRequest ) . ws . destroy ( err )
158
+ ; ( req as WebsocketRequest ) . ws . end ( )
159
159
}
160
160
161
161
wsApp . use ( wsErrorHandler )
Original file line number Diff line number Diff line change @@ -5,16 +5,14 @@ import * as net from "net"
5
5
6
6
export const handleUpgrade = ( app : express . Express , server : http . Server ) : void => {
7
7
server . on ( "upgrade" , ( req , socket , head ) => {
8
- socket . on ( "error" , ( ) => socket . destroy ( ) )
9
-
10
8
req . ws = socket
11
9
req . head = head
12
10
req . _ws_handled = false
13
11
14
12
// Send the request off to be handled by Express.
15
13
; ( app as any ) . handle ( req , new http . ServerResponse ( req ) , ( ) => {
16
14
if ( ! req . _ws_handled ) {
17
- socket . destroy ( new Error ( " Not found" ) )
15
+ socket . end ( "HTTP/1.1 404 Not Found\r\n\r\n" )
18
16
}
19
17
} )
20
18
} )
You can’t perform that action at this time.
0 commit comments