From 6464d8f89bd74aaaed380cee15143e6ad0aad614 Mon Sep 17 00:00:00 2001 From: Scott Gress Date: Tue, 1 Nov 2016 12:06:50 -0500 Subject: [PATCH] Remove legacy 0.9.x socket support --- lib/hooks/pubsub/index.js | 61 --------------------------------------- 1 file changed, 61 deletions(-) diff --git a/lib/hooks/pubsub/index.js b/lib/hooks/pubsub/index.js index e72db928b8..b9682e0377 100644 --- a/lib/hooks/pubsub/index.js +++ b/lib/hooks/pubsub/index.js @@ -274,19 +274,6 @@ module.exports = function(sails) { self.broadcast( room, eventName, data, socketToOmit ); - // Also broadcasts a message to the legacy instance room (derived by - // using the `legacy_v0.9` context). - // Uses traditional eventName === "message". - // Uses traditional message format. - if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients']) { - var legacyRoom = self.room(id, 'legacy_v0.9'); - var legacyMsg = _.cloneDeep(data); - legacyMsg.model = self.identity; - if (legacyMsg.verb === 'created') { legacyMsg.verb = 'create'; } - if (legacyMsg.verb === 'updated') { legacyMsg.verb = 'update'; } - if (legacyMsg.verb === 'destroyed') { legacyMsg.verb = 'destroy'; } - self.broadcast( legacyRoom, 'message', legacyMsg, socketToOmit ); - } }); } @@ -460,16 +447,6 @@ module.exports = function(sails) { } - // If the subscribing socket is using the legacy (v0.9.x) socket SDK (sails.io.js), - // always subscribe the client to the `legacy_v0.9` context. - // if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients'] && socket.handshake) { - // var sdk = app.getSDKMetadata(socket.handshake); - // var isLegacySocketClient = sdk.version === '0.9.0'; - // if (isLegacySocketClient) { - // contexts.push('legacy_v0.9'); - // } - // } - // Subscribe to model instances records = self.pluralize(records); var ids = _.pluck(records, this.primaryKey); @@ -521,14 +498,6 @@ module.exports = function(sails) { contexts = this.getAllContexts(); } - // if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients'] && socket.handshake) { - // var sdk = app.getSDKMetadata(socket.handshake); - // var isLegacySocketClient = sdk.version === '0.9.0'; - // if (isLegacySocketClient) { - // contexts.push('legacy_v0.9'); - // } - // } - records = self.pluralize(records); var ids = _.pluck(records, this.primaryKey); _.each(ids,function (id) { @@ -1200,21 +1169,6 @@ module.exports = function(sails) { var eventName = this.identity; this.broadcast(this._classRoom(), eventName, payload, socketToOmit); - // Also broadcasts a message to the legacy class room (derived by - // using the `:legacy_v0.9` trailer on the class room name). - // Uses traditional eventName === "message". - // Uses traditional message format. - if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients']) { - var legacyData = _.cloneDeep({ - verb: 'create', - data: values, - model: self.identity, - id: values[this.primaryKey] - }); - var legacyRoom = this._classRoom()+':legacy_v0.9'; - self.broadcast( legacyRoom, 'message', legacyData, socketToOmit ); - } - // Subscribe watchers to the new instance if (!options.noIntroduce) { this._introduce(values[this.primaryKey]); @@ -1242,14 +1196,6 @@ module.exports = function(sails) { sails.sockets.join(socket, this._classRoom()); sails.log.silly('Subscribed socket ', sails.sockets.getId(socket), 'to', this._classRoom()); - // if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients'] && socket.handshake) { - // var sdk = app.getSDKMetadata(socket.handshake); - // var isLegacySocketClient = sdk.version === '0.9.0'; - // if (isLegacySocketClient) { - // sails.sockets.join(socket, this._classRoom()+':legacy_v0.9'); - // } - // } - }, /** @@ -1268,13 +1214,6 @@ module.exports = function(sails) { sails.sockets.leave(socket, this._classRoom()); sails.log.silly('Unubscribed socket ', sails.sockets.getId(socket), 'from', this._classRoom()); - // if (sails.config.sockets['backwardsCompatibilityFor0.9SocketClients'] && socket.handshake) { - // var sdk = app.getSDKMetadata(socket.handshake); - // var isLegacySocketClient = sdk.version === '0.9.0'; - // if (isLegacySocketClient) { - // sails.sockets.leave(socket, this._classRoom()+':legacy_v0.9'); - // } - // } },