dataCenter.socket.abort({ reqId: reqData.id }, function(data, xhr) { if (!data) { util.showSystemError(xhr); } else { reqData.closed = true; self.autoRefresh(); } });
/** * @description Listen. * @example * xiaomi.listen(); */ function listen() { this.socket = this.dgram.createSocket({ type: 'udp4', reuseAddr: true }); this.socket.on('listening', eventFunctionWrapper(this.listening.bind(this))); this.socket.on('message', eventFunctionWrapper(this.onMessage.bind(this))); // this.socket.on('data.weather', this.addTemperatureSensor.bind(this)); this.socket.bind(SERVER_PORT); }
function write() { // We can not write to the socket if it's destroyed obviously ... if (self.destroyed) return; self._writable = false; self.socket._write(self.id, chunk, encoding, callback); }
function getClientIp(req) { var ip; var headers = req.headers || {}; try { ip = getForwardedFor(headers); if (!ip) { ip = (req.connection || req.socket || req).remoteAddress; ip = removeIPV6Prefix(ip); } } catch(e) {} return isLocalIp(ip) ? LOCALHOST : ip; }
dataCenter.socket.send(params, function(data, xhr) { if (!data) { return util.showSystemError(xhr); } if (data.ec !== 0) { return message.error('Server busy, try again later.'); } cb && cb(); });
this.socket.on("disconnect",function () { let index=arrClient.indexOf(_this); if(index>-1) { arrClient.splice(index,1); } })
dataCenter.socket.changeStatus(params, function(data, xhr) { if (!data) { util.showSystemError(xhr); } else { if (isSend) { reqData.sendStatus = option.value; } else { reqData.receiveStatus = option.value; } self.setState({}); } });
/** * @description Listen. * @example * xiaomi.listen(); */ function listen() { this.socket = this.dgram.createSocket({ type: 'udp4', reuseAddr: true }); this.socket.on('listening', eventFunctionWrapper(this.listening.bind(this))); this.socket.on('message', eventFunctionWrapper(this.onMessage.bind(this))); // this.socket.on('data.weather', this.addTemperatureSensor.bind(this)); this.socket.bind(SERVER_PORT); }
/** * @description Listen. * @example * xiaomi.listen(); */ function listen() { this.socket = this.dgram.createSocket({ type: 'udp4', reuseAddr: true }); this.socket.on('listening', eventFunctionWrapper(this.listening.bind(this))); this.socket.on('message', eventFunctionWrapper(this.onMessage.bind(this))); // this.socket.on('data.weather', this.addTemperatureSensor.bind(this)); this.socket.bind(SERVER_PORT); }
function write() { // We can not write to the socket if it's destroyed obviously ... if (self.destroyed) return; self._writable = false; self.socket._write(self.id, chunk, encoding, callback); }