Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else if ('socket.io' === test) {
var io = require('socket.io'),
socket = io.connect(uri);
socket.on('connect', function () {
Ti.API.log('connected!')
});
}
// ****************************************************************************************************************
// ****************************************************************************************************************
// example using now.js which uses socket.io which uses websockets
else if ('nowjs' === test) {
var now = require('now').nowInitialize(uri, {
// socket.io init options
socketio: {
transports: ['websocket']
}
});
now.core.on('error', function () {
Ti.API.error('error!')
});
now.core.on('ready', function () {
Ti.API.log('now is now ready')
});
now.core.on('disconnect', function () {
Ti.API.log('now disconnected');
else if ('socket.io' === test) {
var io = require('socket.io'),
socket = io.connect(uri);
socket.on('connect', function () {
Ti.API.log('connected!')
});
}
// ****************************************************************************************************************
// ****************************************************************************************************************
// example using now.js which uses socket.io which uses websockets
else if ('nowjs' === test) {
var now = require('now').nowInitialize(uri, {
// socket.io init options
socketio: {
transports: ['websocket']
}
});
now.core.on('error', function () {
Ti.API.error('error!')
});
now.core.on('ready', function () {
Ti.API.log('now is now ready')
});
now.core.on('disconnect', function () {
Ti.API.log('now disconnected');