What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-05 00:37:16
socket emit to specific room using nodejs socket.io
// sending to sender-client only socket.emit('message', "this is a test"); // sending to all clients, include sender io.emit('message', "this is a test"); // sending to all clients except sender socket.broadcast.emit('message', "... Add solution -
Kotlin 2021-10-24 00:43:08
socket.io kotlin
//kotlin import com.github.nkzawa.emitter.Emitter import com.github.nkzawa.socketio.client.IO import com.github.nkzawa.socketio.client.Socket val socket = IO.socket("http://localhost:4000/") socket.on(Socket.EVENT_CONNECT, Emitter.Listener { ... Add solution -
Javascript 2021-10-22 06:12:09
socket io emit to socket id
socket.emit('message', "this is a test"); //sending to sender-client only socket.broadcast.emit('message', "this is a test"); //sending to all clients except sender socket.broadcast.to('game').emit('message', 'nice game'); //sending to... Add solution -
Javascript 2021-10-20 06:34:05
call node js function from javascript
var io = require('socket.io').listen(80); // initiate socket.io server io.sockets.on('connection', function (socket) { socket.emit('news', { hello: 'world' }); // Send data to client // wait for the event raised by the client socket.on('my other e... Add solution -
Other 2021-10-12 18:50:08
send different data to sender and clients
// sending to sender-client only socket.emit('message', "this is a test"); // sending to all clients, include sender io.emit('message', "this is a test"); // sending to all clients except sender socket.broadcast.emit('message', "... Add solution -
Javascript 2021-09-23 00:27:02
js socket.emit
var socket = io.connect('http://localhost'); socket.emit('my other event', { my: 'data' }); //server side io.sockets.on('connection', function (socket) { socket.on('my other event', function (data) { console.log(data); }); }); //sending data from ... Add solution -
Javascript 2021-09-21 22:31:07
socket.io client send data node js server
var socket = io.connect('http://localhost'); socket.emit('my other event', { my: 'data' }); //server side io.sockets.on('connection', function (socket) { socket.on('my other event', function (data) { console.log(data); }); }); //sending data from ... Add solution