前端通过stompjs sockjs连接到后端spring boot websocket server,后端server通过StompBrokerRelay连接到eqmx 5.x的stomp网关,刚开始可以建立连接,一会就断开了。
Opening Web Socket…
stomp.js:763 Web Socket Opened…
stomp.js:763 >>> CONNECT
user:AAA
accept-version:1.0,1.1,1.2
heart-beat:60000,60000
stomp.js:763 Received data
stomp.js:763 <<< CONNECTED
user-name:AAA
heart-beat:60000,60000
version:1.2
server:emqx-stomp/1.2
content-length:0
stomp.js:763 connected to server emqx-stomp/1.2
stomp.js:763 send PING every 60000ms
stomp.js:763 check PONG every 60000ms
index.js:50 Connected: CONNECTED
user-name:AAA
heart-beat:60000,60000
version:1.2
server:emqx-stomp/1.2
content-length:0
stomp.js:763 >>> SUBSCRIBE
id:sub-0
destination:/topic/system-date
stomp.js:763 >>> SUBSCRIBE
id:sub-1
destination:/topic/broadcast
stomp.js:763 >>> SUBSCRIBE
id:sub-2
destination:/topic/room.room1
stomp.js:763 >>> SUBSCRIBE
id:sub-3
destination:/user/queue/to-user
stomp.js:763 Received data
stomp.js:763 <<< MESSAGE
content-length:66
content-type:application/json
destination:/topic/broadcast
message-id:1
subscription:sub-1
content-length:66
stomp.js:763 >>> SEND
destination:/app/broadcast
content-length:66
…
stomp.js:763 >>> PING
stomp.js:763 Received data
stomp.js:763 <<< MESSAGE
content-length:75
content-type:application/json
destination:/topic/system-date
message-id:8
subscription:sub-0
content-length:75
stomp.js:763 Received data
stomp.js:763 <<< ERROR
content-length:0
message:Connection to broker closed.
content-length:0
stomp.js:763 Connection closed to undefined
相同的前端程序,emqx版本为4.4.x的时候程序正常,没问题。
不知道5.x需要配置什么特殊配置,还是不支持这种使用方式?