Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring如何管理到RabbitMQ的websocket连接?_Spring_Rabbitmq_Spring Websocket - Fatal编程技术网

Spring如何管理到RabbitMQ的websocket连接?

Spring如何管理到RabbitMQ的websocket连接?,spring,rabbitmq,spring-websocket,Spring,Rabbitmq,Spring Websocket,我有一个游戏服务器,它使用websocket进行实时多人游戏。这是一个Spring4应用程序,我使用RabbitMQ作为代理。这是我的配置: <websocket:message-broker application-destination-prefix="/app"> <websocket:stomp-endpoint path="/portfolio"> <websocket:sockjs/> </websocket:

我有一个游戏服务器,它使用websocket进行实时多人游戏。这是一个Spring4应用程序,我使用RabbitMQ作为代理。这是我的配置:

<websocket:message-broker application-destination-prefix="/app">
    <websocket:stomp-endpoint path="/portfolio">
        <websocket:sockjs/>
    </websocket:stomp-endpoint>
    <websocket:simple-broker prefix="/queue, /topic"/>
</websocket:message-broker>

在对4个客户端进行的一个非常小的测试中,我看到Rabbit上有4个连接打开


是否每个使用websocket连接到我的服务器的客户端最终都会打开到代理的新连接(RabbitMQ)?可以配置吗?

是的,每个websocket客户端都有自己到代理的TCP连接。文件中有一个章节(强调矿山):

STOMP代理中继维护到代理的单个“系统”TCP连接。此连接仅用于来自服务器端应用程序的消息,而不用于接收消息。[……]

STOMP代理中继还为每个连接的WebSocket客户端创建单独的TCP连接。[……]

我不知道这是否可以配置,我对Spring的这一部分不太熟悉,但我认为应该是这样的;弹簧可以伸展。我的建议是在项目上发布一个问题,并询问细节

编辑:OP在SpringWebSocket项目组合中打开了以下内容