oncesk / yii-node-socket

66 stars 46 forks source link

how get online users #69

Open asadkhalili opened 9 years ago

asadkhalili commented 9 years ago

how can i get the online users on application?

oncesk commented 9 years ago

No way to get users, only send message

oncesk commented 9 years ago

You can implement yourself

taha-deris commented 9 years ago

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...

oncesk commented 9 years ago

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 notifications@github.com:

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 commented 9 years ago

do not forget clean assets after this changes

2015-11-25 11:40 GMT+03:00 unFly unnfly@gmail.com:

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 notifications@github.com:

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 .