Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(url) {
this.url = url || 'http://local.mockstarjs.org';
this.socket = io(this.url);
// 序列号,用于识别不同的事件
this._seq = 0;
this.init();
}
io.configure('production', function() {
io.enable('browser client minification'); // send minified client
io.enable('browser client etag'); // apply etag caching logic based on version number
io.enable('browser client gzip'); // gzip the file
io.set('log level', 1); // reduce logging
io.set('transports', [ // enable all transports (optional if you want flashsocket)
'websocket'
, 'flashsocket'
, 'htmlfile'
, 'xhr-polling'
, 'jsonp-polling'
]);
});
exports.start = function() {
setupRoutes();
// Create our tiny little HTTP server.
var server = http.createServer(handleRequest);
server.listen(config.site.port, config.site.ip);
// I don't like this. But it works, I think.
exports.io = io.listen(server);
// Since everything is loaded, let's celebrate!
logger.log('info', 'Started on %s:%d', config.site.ip, config.site.port);
};
/**
* Created by massi on 30/08/15.
*/
var io=require('socket.io-client');
var socket= io.connect('http://localhost:3000');
console.log("GET BrowseLibrary\n\n");
socket.emit('unInstallPlugin', { category:'music_services',name:''});
socket.on('installPluginStatus',function(data)
{
console.log(data);
//console.log(JSON.parse(data));
});
#!/bin/node
var io=require('socket.io-client');
var socket= io.connect('http://localhost:3000');
socket.emit('getState', '');
socket.on('pushState',function(data)
{
console.log(data);
process.exit()
});
/**
* Created by massi on 30/08/15.
*/
var io=require('socket.io-client');
var socket= io.connect('http://localhost:3000');
socket.emit('setBackgrounds',{name:'Morning',path:'morning.jpg'});
socket.on('pushBackgrounds',function(data)
{
console.log(data);
//console.log(JSON.parse(data));
});
/**
* Created by massi on 30/08/15.
*/
var io=require('socket.io-client');
var socket= io.connect('http://localhost:3000');
console.log("GET BrowseLibrary\n\n");
socket.emit('preUninstallPlugin', { category:'music_service',name:'spop'});
socket.on('openModal',function(data)
{
console.log(data);
//console.log(JSON.parse(data));
});
#!/bin/node
var io=require('socket.io-client');
var socket= io.connect('http://localhost:3000');
var volume = Number(process.argv.slice(2));
socket.emit('volume', volume);
socket.on('pushState',function(data)
{
console.log('Volume is now: '+data.volume);
process.exit()
});
var http = require('http');
server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
var io = require('socket.io').listen(server);
io.sockets.on('connection', function(socket) {
socket.on('message', function(message) {
socket.broadcast.emit('message', message);
});
});
console.log('Server running at http://127.0.0.1:1337/');
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);
server.listen(80); //for local test
//server.listen(process.env.PORT || 3000);//for publish to heroku
app.use("/", express.static(__dirname + '/public'));
io.sockets.on('connection', function (socket) {
socket.on('msg', function (data) {
io.sockets.emit('new', data);
});
});