* Parses the response from the server\r
*/\r
this.parse = function (command, data) {\r
+ var network_trigger = '';\r
\r
// Trigger the connection specific events (used by Network objects)\r
if (typeof data.connection_id !== 'undefined') {\r
- that.trigger('connection:' + data.connection_id.toString(), {\r
+ network_trigger = 'connection:' + data.connection_id.toString();\r
+\r
+ that.trigger(network_trigger, {\r
event_name: command,\r
event_data: data\r
});\r
\r
// Some events trigger a more in-depth event name\r
if (command == 'message' && data.type) {\r
- that.trigger('connection:' + data.connection_id.toString(), {\r
+ that.trigger('connection ' + network_trigger, {\r
event_name: 'message:' + data.type,\r
event_data: data\r
});\r
}\r
\r
if (command == 'channel' && data.type) {\r
- that.trigger('connection:' + data.connection_id.toString(), {\r
+ that.trigger('connection ' + network_trigger, {\r
event_name: 'channel:' + data.type,\r
event_data: data\r
});\r