mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-15 01:48:01 -05:00
Related: https://github.com/socketio/socket.io/discussions/3778 Reference: http://nginx.org/en/docs/http/ngx_http_upstream_module.html#hash
14 lines
303 B
JavaScript
14 lines
303 B
JavaScript
const socket = require('socket.io-client')('ws://nginx');
|
|
|
|
socket.on('connect', () => {
|
|
console.log('connected');
|
|
});
|
|
|
|
socket.on('my-name-is', (serverName) => {
|
|
console.log(`connected to ${serverName}`);
|
|
});
|
|
|
|
socket.on('disconnect', (reason) => {
|
|
console.log(`disconnected due to ${reason}`);
|
|
});
|