简体   繁体   English

如何使用socket.io从客户端创建多个websocket连接?

[英]How to create multiple websocket connections from client using socket.io?

I am doing project where my requirement is to connect to muliple servers from clients and monitor multiple server resources like cpu,memory,etc.. 我正在做一个项目,我的要求是从客户端连接到多服务器,并监视多个服务器资源,例如cpu,内存等。

Currently i am using socket.io library for multiple client to single server using websocket. 目前,我正在使用socket.io库将多个客户端使用websocket连接到单个服务器。 Can anyone tell me how to create multiple socket based on ip address of server from client like tabbed putty (adding one more server) 谁能告诉我如何根据客户端的IP地址创建多个套接字,例如选项卡式腻子(添加一台服务器)

Everytime you create a new connection you have to pass a parameter to force a new connection: var socket = io.connect(URL, {'force new connection': true }); 每次创建新连接时,都必须传递参数以强制建立新连接: var socket = io.connect(URL, {'force new connection': true });

It is stated in their documentation http://socket.io/docs/client-api/ 在他们的文档http://socket.io/docs/client-api/中有说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM