Yes, you can create custom events and "emit" then and detect them using "on",
Socket.IO is a library that enables real-time, bidirectional and event-based communication between the browser and the server. It consists of: a Node.js, may be i am not clearly understanding second part of your question about "What Socket.IO apply for" but i guess if you will google ,you might get some more insight into library.
`//in node js i.e. server side
socket.on('has connected', function (username) {
console.log('connected Udsfh');
username = username;
users.push(username);
console.log(username);
io.emit('has connected', users);
});`
`//client side--just a sample to catch the emitted event and use it
var socket = io();
socket.on('has connected', function (users) {
for (var i = 0; i < users.length; i++) {
$("users").append("<li><b>" + users[i] + "</b></li>");
}
});