Skip to content

Commit

Permalink
Merge pull request #2314 from GValeriy/master
Browse files Browse the repository at this point in the history
fix: Restrict subscriptions WS server to add listeners only to its own path
  • Loading branch information
kamilmysliwiec committed Sep 1, 2022
2 parents ca8cabb + 64c59fa commit 593a0d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/graphql/lib/services/gql-subscription.service.ts
Expand Up @@ -138,9 +138,11 @@ export class GqlSubscriptionService {
? this.subTransWs
: this.wss;

wss.handleUpgrade(req, socket, head, (ws) => {
wss.emit('connection', ws, req);
});
if (req.url?.startsWith(wss.options.path)) {
wss.handleUpgrade(req, socket, head, (ws) => {
wss.emit('connection', ws, req);
});
}
});
}

Expand Down

0 comments on commit 593a0d1

Please sign in to comment.