socket.on('connect', () => { socket.emit('init', 'hotword-node') console.log('Connected to the server') console.log('Waiting for hotword...') })
socket.emit('hotword-detected', obj) })
constructor(props) { super(props); const { dispatch } = this.props; this.socket = io('http://localhost:8888'); this.socket.emit('NEW_PLAYER', {player: this.props.player}); this.socket.on('game', function(data) { dispatch({type: 'GAME_STATE', game: data.game}); }); }
async calculateLatency() { if (this.socket === null) { throw new Error('Not connected to socket, cannot send message'); } return new Promise((resolve, reject) => { this.socket.emit('latency', Date.now(), (startTime) => { const latency = Date.now() - startTime; resolve(latency); }); }); }
describe('Receiver', function () { it('should receive unknown sender (bad sender)', function (done) { let socket = buildConnection("/receive"); let unknownSenderId = 'unknown'; socket.on('alert', function (msg) { socket.close(true); should(msg).be.equal('unknown senderID: '+unknownSenderId); done(); }); socket.emit('rcv_sender', unknownSenderId) }); });
test('it should not crash when sent an empty message', function (t) { t.plan(1); var client = io.connect(socketURL, socketOptions); client.on('connect', function () { client.emit('message'); t.ok(true); }); });
function send(event) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } socket.emit.apply(socket, ['response-from-front', event].concat(args)); }
t.on('connect',function(res){ t.emit('FLV',{ ke:e.config.ke, id:e.config.id, auth:e.config.auth_token, uid:e.config.uid, channel:e.config.channel, }); _this._status = l.LoaderStatus.kBuffering; });
socket.on('requestCredits', async payload => { if (payload && payload.streamDate) { try { const stream = await db.getFullStream(payload.streamDate); if (stream) { socket.emit('onCreditRoll', { stream }); } } catch (err) { console.log(err); } } });
const handleTableData = function (n: ISumanChildProcess, data: any, s: SocketIOClient.Socket) { runnerObj.tableCount++; tableRows[n.shortTestPath].tableData = data; s.emit(TABLE_DATA, {info: 'table-data-received'}); }
socketClient.on('connect', () => { socketClient.emit('npmStop'); setTimeout(() => { process.exit(0); }, 1000); });
// =================================================== \\ // ====================SOCKET-IO====================== \\ // =================================================== \\ nodeRatIo.on("connect", function(socket){ console.log("[SYSTEM] Client try connecte to cloud."); // Connexion au Cloud node nodeRatIo.emit("initNodeClient", { 'client_serial' : client_serial, 'client_key' : client_key, 'cloud_password' : cloud_password }); });
// Auth success handler. socket.on('loginConfirmed', userName => { // Join room named 'default'. socket.emit('roomJoin', 'default', (error, data) => { // Check for a command error. if (error) { return } // Now we will receive 'default' room messages in 'roomMessage' handler. // Now we can also send a message to 'default' room: socket.emit('roomMessage', 'default', { textMessage: 'Hello!' }) }) })