async resolve(from: string) { const configCandidates = configLookup(this.configFile, from) const { exists, load, none } = this.io for (const candidate of configCandidates) { if (await exists(candidate)) { return load(candidate) } } return none(from) }
const _this$io = _this.io, exists = _this$io.exists, load = _this$io.load,
getAdminSocket() { if (this.io == null) { throw new Error('Http server has not attached yet.'); } return this.adminNamespace; }
constructor(appContainer, namespace) { super(); this.appContainer = appContainer; this.appContainer.registerContainer(this); const ns = namespace || '/'; this.socket = io(ns, { transports: ['websocket'], }); this.socketClientId = Math.floor(Math.random() * 100000); this.state = { }; }
/** * `Socket` constructor. * * @api public */ function Socket(io, nsp){ this.io = io; this.nsp = nsp; this.json = this; // compat this.ids = 0; this.acks = {}; if (this.io.autoConnect) this.open(); this.receiveBuffer = []; this.sendBuffer = []; this.connected = false; this.disconnected = true; }
const function2 = (actor1) => function * (msg) { yield io(console.log, `Sending ${msg} to actor1's list`); yield dispatch(actor1, msg); }
attachServer(server) { this.io = socketIo(server, { transports: ['websocket'], }); // create namespace for admin this.adminNamespace = this.io.of('/admin'); }
// Registers new WebClient with Server announce_web_client(socket:any) { let rserver = this; let web_client = new _wc.WebClient(socket, rserver); rserver.web_clients[web_client.id] = web_client; __(rserver.nodes).each(function (node, nlabel) { web_client.add_node(node as any); }); setInterval(function () { rserver.io.sockets.in('web_clients').emit('statusreport', { status: rserver.status }); }, STATUS_INTERVAL / 10); socket.on('webreport', function (message: string) { if (rserver.status === STATUS_RUNNING) { socket.emit('webreport', rserver.runconfig.agent, rserver.runconfig.maxuser, stat.getTimeData(), stat.getCountData()); } }); socket.on('detailreport', function (message: string) { if (rserver.status === STATUS_RUNNING) { socket.emit('detailreport', stat.getDetails()); } }); socket.on('disconnect', function () { delete rserver.web_clients[web_client.id]; }); }
_connectSocket() { window.socket = io(`${this.WEBSITE_ADDRESS}?token=${this._userInfo.token}`); }
this.socket = io(matchMakerAnswer.serverURL, options);
let rserver = this; rserver.io.sockets.on('connection', function (socket:any) { socket.on('announce_node', function (message: string) { rserver.log.info('Registering new node ' + JSON.stringify(message)); socket.on('ready', function (msg: any) { console.log('server begin ready client ...'); rserver.io.sockets.in('nodes').emit('disconnect', {}); stat.clear(); rserver.status = STATUS_READY; rserver.io.sockets.emit('heartbeat'); }, HEARTBEAT_INTERVAL);
get isInitialized() { return (this.io != null); }
const function1 = function * (state, msg, ct) { const nextState = state ? state + '\n' + msg : msg; yield io(console.log, nextState); return nextState; }
// Registers new WebClient with Server announce_web_client(socket:any) { let rserver = this; let web_client = new _wc.WebClient(socket, rserver); rserver.web_clients[web_client.id] = web_client; __(rserver.nodes).each(function (node, nlabel) { web_client.add_node(node as any); }); setInterval(function () { rserver.io.sockets.in('web_clients').emit('statusreport', { status: rserver.status }); }, STATUS_INTERVAL / 10); socket.on('webreport', function (message: string) { if (rserver.status === STATUS_RUNNING) { socket.emit('webreport', rserver.runconfig.agent, rserver.runconfig.maxuser, stat.getTimeData(), stat.getCountData()); } }); socket.on('detailreport', function (message: string) { if (rserver.status === STATUS_RUNNING) { socket.emit('detailreport', stat.getDetails()); } }); socket.on('disconnect', function () { delete rserver.web_clients[web_client.id]; }); }