-kiwi.model.Gateway = function () {\r
+_kiwi.model.Gateway = function () {\r
\r
// Set to a reference to this object within initialize()\r
var that = null;\r
var resource;\r
\r
// Work out the resource URL for socket.io\r
- if (kiwi.app.get('base_path').substr(0, 1) === '/') {\r
- resource = kiwi.app.get('base_path');\r
+ if (_kiwi.app.get('base_path').substr(0, 1) === '/') {\r
+ resource = _kiwi.app.get('base_path');\r
resource = resource.substr(1, resource.length-1);\r
resource += '/transport';\r
} else {\r
- resource = kiwi.app.get('base_path') + '/transport';\r
+ resource = _kiwi.app.get('base_path') + '/transport';\r
}\r
\r
this.socket = io.connect(this.get('kiwi_server'), {\r
});\r
\r
this.socket.on('error', function (e) {\r
- console.log("kiwi.gateway.socket.on('error')", {reason: e});\r
+ console.log("_kiwi.gateway.socket.on('error')", {reason: e});\r
that.trigger("connect_fail", {reason: e});\r
});\r
\r
this.socket.on('connecting', function (transport_type) {\r
- console.log("kiwi.gateway.socket.on('connecting')");\r
+ console.log("_kiwi.gateway.socket.on('connecting')");\r
that.trigger("connecting");\r
});\r
\r
this.emit('kiwi', {command: 'connect', nick: that.get('nick'), hostname: host, port: port, ssl: ssl, password:password}, function (err, server_num) {\r
if (!err) {\r
that.server_num = server_num;\r
- console.log("kiwi.gateway.socket.on('connect')");\r
+ console.log("_kiwi.gateway.socket.on('connect')");\r
} else {\r
- console.log("kiwi.gateway.socket.on('error')", {reason: err});\r
+ console.log("_kiwi.gateway.socket.on('error')", {reason: err});\r
callback(err);\r
}\r
});\r
\r
this.socket.on('disconnect', function () {\r
that.trigger("disconnect", {});\r
- console.log("kiwi.gateway.socket.on('disconnect')");\r
+ console.log("_kiwi.gateway.socket.on('disconnect')");\r
});\r
\r
this.socket.on('close', function () {\r
- console.log("kiwi.gateway.socket.on('close')");\r
+ console.log("_kiwi.gateway.socket.on('close')");\r
});\r
\r
this.socket.on('reconnecting', function (reconnectionDelay, reconnectionAttempts) {\r
- console.log("kiwi.gateway.socket.on('reconnecting')");\r
+ console.log("_kiwi.gateway.socket.on('reconnecting')");\r
that.trigger("reconnecting", {delay: reconnectionDelay, attempts: reconnectionAttempts});\r
});\r
\r
this.socket.on('reconnect_failed', function () {\r
- console.log("kiwi.gateway.socket.on('reconnect_failed')");\r
+ console.log("_kiwi.gateway.socket.on('reconnect_failed')");\r
});\r
};\r
\r
break;\r
/*\r
case 'sync':\r
- if (kiwi.gateway.onSync && kiwi.gateway.syncing) {\r
- kiwi.gateway.syncing = false;\r
- kiwi.gateway.onSync(item);\r
+ if (_kiwi.gateway.onSync && _kiwi.gateway.syncing) {\r
+ _kiwi.gateway.syncing = false;\r
+ _kiwi.gateway.onSync(item);\r
}\r
break;\r
*/\r
\r
case 'kiwi':\r
- this.emit('kiwi.' + data.namespace, data.data);\r
+ this.emit('_kiwi.' + data.namespace, data.data);\r
break;\r
}\r
}\r