Socket.io is a library that enables real-time and full-duplex communication between web clients and servers. It uses mechanisms like WebSockets, polling, and flash sockets for browser compatibility. Socket.io provides features like fallback options for cross-browser compatibility, rooms for communicating with subsets of connected clients, namespaces for scaling to complex applications, and authentication of connections. It can be configured to use different transport mechanisms and authenticate connections using handshake data including request headers, date, address, domain, security, and more.
11. Socket.io : Authentifikasi
1. Global dan Namespace
2. HanshakeData
{
headers: req.headers
// <Object> the headers of the request
, time: (new Date) +''
// <String> date time of the connection
, address: socket.address() // <Object> remoteAddress and remotePort object
, xdomain: !!headers.origin // <Boolean> was it a cross domain request?
, secure: socket.secure
// <Boolean> https connection
, issued: +date
// <Number> EPOCH of when the handshake was created
, url: request.url
// <String> the entrance path of the request
, query: data.query
// <Object> the result of url.parse().query or a empty object
}