Reputation: 5123
I am newbie to socket.io,and I was looking for the events like "message"
and I want to know what are they aside from message.
socket.on('message', function (msg) {
});
Thank you in advance.
Upvotes: 0
Views: 39
Reputation: 18093
You create your own events; they are not predefined, ie:
socket.on('< whatever you want >', function (payload) {
console.log('Hello World')
});
socket.emit('< whatever you want >', payload);
>>> 'Hello World'
For example:
socket.on('marco', function (payload) {
console.log(payload.msg)
});
socket.emit('marco', {msg: 'polo!'});
>>> 'polo!'
There are some special names that are restricted however. These are:
Upvotes: 2