且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Spring 4 WebSocket 配置端口

更新时间:2023-01-14 10:48:07

AFAIK 所有当前的 websockets 实现都依赖于通过 HTTP 的握手.握手后,现有连接升级.你没有得到一个新的,端口保持不变.基本上所有的 websocket 连接都是从 HTTP 连接开始的.

AFAIK all current implementations of websockets depend on a handshake via HTTP. After the handshake the existing connection is upgraded. You don't get a new one and the port stays the same. Basically all websocket connections start as HTTP connections.

顺便说一下,端口、IP 地址等是服务器的主题,而不是应用程序本身.

As a side note the ports, IP addresses etc. are subject of the server, not the application itself.

可能可以配置您的服务器,以便两个端口可用于应用程序,但它们都可用于 HTTP 和 websocket.另一方面,这可能对您的情况有用.

It might be possible to configure your server so that two ports can be used for an application, but they would both be used for HTTP and websocket alike. On the other hand this might be useful in your situation.