Skip to content

Commit

Permalink
Remove legacy 0.9.x socket support
Browse files Browse the repository at this point in the history
  • Loading branch information
sgress454 committed Nov 1, 2016
1 parent 86b8884 commit 6464d8f
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions lib/hooks/pubsub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
});
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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');
// }
// }

},

/**
Expand All @@ -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');
// }
// }
},


Expand Down

0 comments on commit 6464d8f

Please sign in to comment.