From 870cc7c26b3c318d0f56cf746c3e121fc397bf97 Mon Sep 17 00:00:00 2001 From: dotansimha Date: Sun, 4 Jun 2017 12:18:11 +0200 Subject: [PATCH 1/2] chore(deps): updated dev dependencies --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4fd3a1bb3..336dd9c33 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "pretest": "npm run compile", "test": "npm run testonly --", "posttest": "npm run lint", - "lint": "tslint --format=stylish --type-check --project ./tsconfig.json", + "lint": "tslint --format stylish --type-check --project ./tsconfig.json", "watch": "tsc -w", "testonly": "mocha --reporter spec --full-trace ./dist/test/**/*.js", "coverage": "node ./node_modules/istanbul/lib/cli.js cover _mocha -- --full-trace ./dist/test/tests.js", @@ -38,16 +38,16 @@ "@types/graphql": "^0.9.0", "@types/lodash": "4.14.64", "@types/mocha": "^2.2.41", - "@types/node": "^7.0.22", - "@types/sinon": "^2.1.3", + "@types/node": "^7.0.27", + "@types/sinon": "^2.3.0", "chai": "^3.5.0", - "istanbul": "^1.0.0-alpha.2", "graphql": "^0.10.0", + "istanbul": "^1.0.0-alpha.2", "lodash": "^4.17.1", "mocha": "^3.3.0", "remap-istanbul": "^0.9.5", "sinon": "^2.1.0", - "tslint": "^5.1.0", + "tslint": "^5.4.2", "typescript": "^2.3.0", "webpack": "^2.4.1" }, From 3b80b940cad25f3fdd8de6a0e835f566f1597a50 Mon Sep 17 00:00:00 2001 From: dotansimha Date: Sun, 4 Jun 2017 12:24:59 +0200 Subject: [PATCH 2/2] chore(deps): updated dependencies and usage --- package.json | 6 +++--- src/server.ts | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 336dd9c33..ce310a7fe 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "url": "git+https://github.com/apollostack/subscriptions-transport-ws.git" }, "dependencies": { - "@types/ws": "^0.0.41", + "@types/ws": "^3.0.0", "backo2": "^1.0.2", "eventemitter3": "^2.0.3", "graphql-subscriptions": "^0.4.1", @@ -34,9 +34,9 @@ "prepublish": "npm run compile && npm run browser-compile" }, "devDependencies": { - "@types/chai": "^3.5.1", + "@types/chai": "^4.0.0", "@types/graphql": "^0.9.0", - "@types/lodash": "4.14.64", + "@types/lodash": "^4.14.65", "@types/mocha": "^2.2.41", "@types/node": "^7.0.27", "@types/sinon": "^2.3.0", diff --git a/src/server.ts b/src/server.ts index 05498b5be..eda235768 100644 --- a/src/server.ts +++ b/src/server.ts @@ -125,7 +125,9 @@ export class SubscriptionServer { this.wsServer = new WebSocket.Server(socketOptions || {}); this.wsServer.on('connection', ((socket: WebSocket, request: IncomingMessage) => { - socket.upgradeReq = request; + // Add `upgradeReq` to the socket object to support old API, without creating a memory leak + // See: https://github.com/websockets/ws/pull/1099 + (socket as any).upgradeReq = request; // NOTE: the old GRAPHQL_SUBSCRIPTIONS protocol support should be removed in the future if (socket.protocol === undefined || (socket.protocol.indexOf(GRAPHQL_WS) === -1 && socket.protocol.indexOf(GRAPHQL_SUBSCRIPTIONS) === -1)) {