3.1.2 io([url][,optiosn])
url
(String) (默认为window.location
)options
(Object)forceNew
(Boolean) 是否重用现有连接
- Returns
Socket
为给定的URL创建新的
管理器
,并尝试在后续调用中重用现有的管理器
,除非用false
传递多路复用
选项。传递此选项等同于传递force new connection:true
或forcenew:true
。为URL中路径名指定的命名空间返回新的
Socket
实例,默认为/
。例如,如果url
为http://localhost/users
,则将建立到http://localhost
的传输连接,并将建立到/users
的socket.io连接。Last modified 3yr ago