socket 对象中 那些属性是 根据不同用户 而不同的
发布于 2年前 作者 cxh80301983 631 次浏览

{ id: 'LZC8J5xDds5YM8BSYeQQ’, namespace: { manager: { server: [Object], namespaces: [Object], sockets: [Circular], _events: [Object], settings: [Object], handshaken: [Object], connected: [Object], open: [Object], closed: {}, rooms: [Object], roomClients: [Object], oldListeners: [Object], sequenceNumber: 1969349649, gc: [Object] }, name: '’, sockets: { LZC8J5xDds5YM8BSYeQQ: [Circular] }, auth: false, flags: { endpoint: '’, exceptions: [] }, _events: { connection: [Object] } }, manager: { server: { domain: null, _events: [Object], _maxListeners: 10, _connections: 4, connections: [Getter/Setter], _handle: [Object], _usingSlaves: false, _slaves: [], allowHalfOpen: true, httpAllowHalfOpen: false, timeout: 120000, _connectionKey: ‘4:0.0.0.0:8800’ }, namespaces: { '’: [Object] }, sockets: { manager: [Circular], name: '’, sockets: [Object], auth: false, flags: [Object], _events: [Object] }, _events: { 'set:transports’: [Object], 'set:store’: [Function], 'set:origins’: [Function], 'set:flash policy port’: [Function], 'set:flash policy server’: [Function] }, settings: { origins: ':', log: false, store: [Object], logger: [Object], static: [Object], heartbeats: true, resource: '/socket.io’, transports: [Object], authorization: false, blacklist: [Object], 'log level’: 3, 'log colors’: true, 'close timeout’: 60, 'heartbeat interval’: 25, 'heartbeat timeout’: 60, 'polling duration’: 20, 'flash policy server’: true, 'flash policy port’: 10843, 'destroy upgrade’: true, 'destroy buffer size’: 100000000, 'browser client’: true, 'browser client cache’: true, 'browser client minification’: false, 'browser client etag’: false, 'browser client expires’: 315360000, 'browser client gzip’: false, 'browser client handler’: false, 'client store expiration’: 15, 'match origin protocol’: false }, handshaken: { LZC8J5xDds5YM8BSYeQQ: [Object], xGDlfV8VQ8kAyjJWYeQR: [Object] }, connected: { LZC8J5xDds5YM8BSYeQQ: true }, open: { LZC8J5xDds5YM8BSYeQQ: true }, closed: {}, rooms: { '’: [Object] }, roomClients: { LZC8J5xDds5YM8BSYeQQ: [Object] }, oldListeners: [ [Function] ], sequenceNumber: 1969349649, gc: { ontimeout: [Function] } }, disconnected: false, ackPackets: 0, acks: {}, flags: { endpoint: '’, room: ‘’ }, readable: true, store: { store: { options: undefined, clients: [Object], manager: [Object] }, id: 'LZC8J5xDds5YM8BSYeQQ’, data: {} }, _events: { error: [Function] } }

举个例子

比如说 id 每个用户都不一样

那些是可以作为 向指定用户发送信息的依据呢 ?

1 回复

服务端向浏览器端发送信息的依据是:客户端连接时,服务端会触发onConnection事件,响应函数中的那个参数client就是依据

回到顶部