栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何在socket.io nodejs服务器上列出房间

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何在socket.io nodejs服务器上列出房间

简短的答案:

io.sockets.adapter.rooms

我分析了

io

我得到以下输出:

{ server:    { stack:       [ [Object],        [Object],        [Object],        [Object],        [Object],        [Object] ],     connections: 3,     allowHalfOpen: true,     watcher: { host: [Circular], callback: [Function] },     _events:       { request: [Function],        connection: [Function: connectionListener],        listening: [Object],        upgrade: [Object] },     httpAllowHalfOpen: false,     cache: {},     settings: { home: '/', env: 'development', hints: true },     redirects: {},     isCallbacks: {},     _locals: { settings: [Object], app: [Circular] },     dynamicViewHelpers: {},     errorHandlers: [],     route: '/',     routes:       { app: [Circular],        routes: [Object],        params: {},        _params: [],        middleware: [Function] },     router: [Getter],     __usedRouter: true,     type: 'tcp4',     fd: 7 },  namespaces:    { '':       { manager: [Circular],        name: '',        sockets: [Object],        auth: false,        flags: [Object],        _events: [Object] } },  sockets:    { manager: [Circular],     name: '',     sockets: { '210837319844898486': [Object] },     auth: false,     flags: { endpoint: '', exceptions: [] },     _events: { connection: [Function] } },  settings:    { origins: '*:*',     log: true,     store:       { options: undefined,        clients: [Object],        manager: [Circular] },     logger: { colors: true, level: 1 },     heartbeats: true,     resource: '/socket.io',     transports:       [ 'websocket',        'htmlfile',        'xhr-polling',        'jsonp-polling' ],     authorization: [Function],     'log level': 1,     'close timeout': 25,     'heartbeat timeout': 15,     'heartbeat interval': 20,     'polling duration': 20,     'flash policy server': true,     'flash policy port': 843,     'destroy upgrade': true,     'browser client': true,     'browser client minification': false,     'browser client etag': false,     'browser client handler': false,     'client store expiration': 15 },  handshaken:    { '210837319844898486':       { headers: [Object],        address: [Object],        time: 'Mon Jul 18 2011 00:53:27 GMT+0200 (CEST)',        xdomain: false,        secure: undefined,        PHPSESSID: '7qo6cht3q0rskhfes4eesb2d05' } },  connected: { '210837319844898486': true },  open: { '210837319844898486': true },  closed: {},  closedA: [],  rooms:    { '': [ '210837319844898486' ],     '/public-alfred': [ '210837319844898486' ] },  roomClients: { '210837319844898486': [ '': true, '/public-alfred': true ] },  oldListeners: [ [Function] ],  _events:    { 'set:origins': [Function],     'set:flash policy port': [Function],     'set:transports': [Function] } }

从单个客户加入“ public-alfred”会议室后,其中

io.sockets.adapter.rooms
包含:

 { '': [ '210837319844898486' ],         '/public-alfred': [ '210837319844898486' ] }


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/427072.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号