socket.io-1.0

How to store client associated data in socket.io 1.0

狂风中的少年 提交于 2020-12-29 02:53:45
问题 The docs say socket.io doesn't support .get .set now Is it okay to store client associated data like io.sockets.on('connection', function (client) { client.on('data', function (somedata) { client['data'] = somedata; }); }); in case I need multiple nodes? 回答1: Yes, it is OK to add properties to the socket.io socket object. You should be careful to not use names that could conflict with built-in properties or methods (I'd suggest adding a leading underscore or namescoping them with some sort of

How to store client associated data in socket.io 1.0

99封情书 提交于 2020-12-29 02:53:06
问题 The docs say socket.io doesn't support .get .set now Is it okay to store client associated data like io.sockets.on('connection', function (client) { client.on('data', function (somedata) { client['data'] = somedata; }); }); in case I need multiple nodes? 回答1: Yes, it is OK to add properties to the socket.io socket object. You should be careful to not use names that could conflict with built-in properties or methods (I'd suggest adding a leading underscore or namescoping them with some sort of

How to store client associated data in socket.io 1.0

隐身守侯 提交于 2020-12-29 02:50:39
问题 The docs say socket.io doesn't support .get .set now Is it okay to store client associated data like io.sockets.on('connection', function (client) { client.on('data', function (somedata) { client['data'] = somedata; }); }); in case I need multiple nodes? 回答1: Yes, it is OK to add properties to the socket.io socket object. You should be careful to not use names that could conflict with built-in properties or methods (I'd suggest adding a leading underscore or namescoping them with some sort of

Getting socket.io response in android client, but can't understand how to implement the response in recycler adapter

冷暖自知 提交于 2020-01-05 02:09:32
问题 I'm working on a real-time chatting android application where I need to connect socket.io for real-time response. I followed this tutorial:https://socket.io/blog/native-socket-io-and-android/ and I've successfully implemented socket.io in my android app and getting the response in a toast. Here is the Socket connection class: import android.app.Application; import java.net.URISyntaxException; import io.socket.client.IO; import io.socket.client.Socket; public class ChatApplication extends

Socket.io 1.0.5 : How to save session variables?

旧时模样 提交于 2020-01-04 14:11:51
问题 Unfortunately socket.io developer team decided to deprecate functions set() and get(). The problem is that these two functions allowed us to save variable into session. So my question is : What is the equivalent of the folloing code on socket.io 1.0.5 ? socket.set('mySessionVar', 'myValue'); socket.get('mySessionVar', function (error, mySessionVar) { console.log('I have a super variable save in the session : '+mySessionVar); socket.emit('mySessionVar', mySessionVar); }); Thank you for your