简体   繁体   English

使用 express 的 websockets 连接

[英]Connections using websockets using express

I am new at nodejs and websockets and i would like to have some explanation about this theme.我是 nodejs 和 websockets 的新手,我想对这个主题做一些解释。 I've already search over the internet and i can only find client/server connections and that is not what i am searching.我已经在互联网上搜索过,我只能找到客户端/服务器连接,这不是我要搜索的。

Basically, i have a nodejs server named "servertes.js" with localhost:8080 that is hosting my webpage.基本上,我有一个名为“servertes.js”的nodejs 服务器,它的localhost:8080 托管了我的网页。

I need to send requests from my webpage to one external server "extServer.js" with 127.0.0.1:3000 that is already made and i don't have control over it.我需要将请求从我的网页发送到一台外部服务器“extServer.js”,该服务器已生成 127.0.0.1:3000,但我无法控制它。 The only server that i have control is "servertest.js".我唯一可以控制的服务器是“servertest.js”。

All the requests must be received by servertest.js that sends the request to the extServer.js and vice-versa. servertest.js 必须接收所有请求,然后将请求发送到 extServer.js,反之亦然。

      ---------           ---------------         --------------
     | Webpage | <------>| servertest.js |<----->| extServer.js |
      ---------           ---------------         --------------

In this scenario you act as the client from your controlled server.在这种情况下,您充当受控服务器的客户端。 Sockets are always host/server to client/receiver.套接字始终是主机/服务器到客户端/接收器。

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

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