You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/webapp/server.ts
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -120,6 +120,10 @@ if (process.env.HTTP_SERVER_DISABLED !== "true") {
120
120
)}`
121
121
);
122
122
123
+
socket.on("error",(err)=>{
124
+
console.error("Connection upgrade error:",err);
125
+
});
126
+
123
127
consturl=newURL(req.url??"","http://localhost");
124
128
125
129
// Upgrade socket.io connection
@@ -133,6 +137,7 @@ if (process.env.HTTP_SERVER_DISABLED !== "true") {
133
137
134
138
// Only upgrade the connecting if the path is `/ws`
135
139
if(url.pathname!=="/ws"){
140
+
// Setting the socket.destroy() error param causes an error event to be emitted which needs to be handled with socket.on("error") to prevent uncaught exceptions.
136
141
socket.destroy(
137
142
newError(
138
143
"Cannot connect because of invalid path: Please include `/ws` in the path of your upgrade request."
0 commit comments