Skip to content

Commit 64c59fa

Browse files
author
Valerii Honcharov
committed
Retrict subscriptions WS server to add listeners only to corresponding path
1 parent 94254a8 commit 64c59fa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/graphql/lib/services/gql-subscription.service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,11 @@ export class GqlSubscriptionService {
132132
? this.subTransWs
133133
: this.wss;
134134

135-
wss.handleUpgrade(req, socket, head, (ws) => {
136-
wss.emit('connection', ws, req);
137-
});
135+
if (req.url?.startsWith(wss.options.path)) {
136+
wss.handleUpgrade(req, socket, head, (ws) => {
137+
wss.emit('connection', ws, req);
138+
});
139+
}
138140
});
139141
}
140142

0 commit comments

Comments
 (0)