yii-node-socket
yii-node-socket copied to clipboard
how get online users
how can i get the online users on application?
No way to get users, only send message
You can implement yourself
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...
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 .
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 .