简体   繁体   English

使用nodejs作为Websocket服务器的客户端。 还是事件驱动的

[英]Using nodejs as a client to a Websocket server. Is it still event driven

I would like to code a performance test creating hundreds of concurrent websocket connections to a vendor's server, that will randomly send/receive messages and then hangup. 我想对性能测试进行编码,以创建与供应商服务器的数百个并发Websocket连接,该连接将随机发送/接收消息,然后挂断。

Can I use Websockets with nodejs to do this and will this be considered event driven? 我可以将Websockets与nodejs一起使用吗,这会被视为事件驱动吗?

To be clear, I am not building a websocket server. 需要明确的是,我没有构建Websocket服务器。 I basically want to use nodejs as a client to connect to an outside websocket server but create hundreds of concurrent connections that it will respond to. 我基本上想将nodejs用作客户端以连接到外部websocket服务器,但要创建数百个并发连接以对其进行响应。

Thanks. 谢谢。

Yes you can use node.js and yes it will be event driven. 是的,您可以使用node.js, 是的 ,它将是事件驱动的。 All network I/O in node.js is exclusively asynchronous and event-driven. node.js中的所有网络I / O都是异步的并且是事件驱动的。

Be aware substack's rant in the hyperquest README about node.js core http module's connection pooling, which you will want to make sure you bypass. 请在hyperquest自述文件中了解有关node.js核心http模块的连接池的子堆栈 ,您需要确保绕过该池。 Presumably you'll be using a helper library such as socket.io or sock.js. 大概您将使用辅助程序库,例如socket.io或sock.js。 Just check that they will create the number of connections you want to a single server without any pooling or throttling. 只需检查它们是否将创建您想要连接到单个服务器的连接数,而无需任何缓冲或限制。

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

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