yii-node-socket icon indicating copy to clipboard operation
yii-node-socket copied to clipboard

how get online users

Open asadkhalili opened this issue 9 years ago • 5 comments

how can i get the online users on application?

asadkhalili avatar Nov 24 '15 16:11 asadkhalili

No way to get users, only send message

oncesk avatar Nov 24 '15 19:11 oncesk

You can implement yourself

oncesk avatar Nov 24 '15 19:11 oncesk

how can emit message from user's browser and get the data in server.js file. i put this code on "on.connection" for io.of('/client') section. but no thing happend... socket.on('event_name' , function(){ console.log('New Message Come'); });

i need this for implement online users...

taha-deris avatar Nov 25 '15 08:11 taha-deris

hi, you need to create method in client js which can return socket and then you can emit, something like this

var socket = new YiiNodeSocket(); // in this class add method if it does not exist - getSocket() : function () {return socket;}

socket.getSocket().emit('event_name', {});

-- server side

socket.on('event_name' , function(){ console.log('New Message Come'); });

2015-11-25 11:14 GMT+03:00 sajad-deris [email protected]:

how can emit message from user's browser and get the data in server.js file. i put this code on "on.connection" for io.of('/client') section. but no thing happend... socket.on('event_name' , function(){ console.log('New Message Come'); });

i need this for implement online users...

— Reply to this email directly or view it on GitHub https://github.com/oncesk/yii-node-socket/issues/69#issuecomment-159530795 .

oncesk avatar Nov 25 '15 08:11 oncesk

do not forget clean assets after this changes

2015-11-25 11:40 GMT+03:00 unFly [email protected]:

hi, you need to create method in client js which can return socket and then you can emit, something like this

var socket = new YiiNodeSocket(); // in this class add method if it does not exist - getSocket() : function () {return socket;}

socket.getSocket().emit('event_name', {});

-- server side

socket.on('event_name' , function(){ console.log('New Message Come'); });

2015-11-25 11:14 GMT+03:00 sajad-deris [email protected]:

how can emit message from user's browser and get the data in server.js file. i put this code on "on.connection" for io.of('/client') section. but no thing happend... socket.on('event_name' , function(){ console.log('New Message Come'); });

i need this for implement online users...

— Reply to this email directly or view it on GitHub https://github.com/oncesk/yii-node-socket/issues/69#issuecomment-159530795 .

oncesk avatar Nov 25 '15 08:11 oncesk