Closed seungholee-dev closed 1 week ago
The Heartbeats depend on the parameters negotiated during the CONNECT phase. Please attach the entire console output so that I can assist you.
Hello exactly the same @kum-deepak (not related to react i'm just using the js client)
import { Client } from '@stomp/stompjs'
let message
let data = []
var url = 'ws://localhost:8082/stomp'
const client = new Client({
brokerURL: url,
heartbeatOutgoing: 2000,
heartbeatIncoming: 2000,
onConnect: () => {
client.subscribe('/foo', frame => {
message = null
data.unshift(JSON.parse(frame.body))
data = data
})
client.subscribe('/foo2', frame => {
console.log(frame)
})
}
})
client.heartbeatOutgoing = 2000 // client will send heartbeats every 20000ms
client.heartbeatIncoming = 2000
client.activate()
// setInterval(() => client.publish({}))
function send() {
client.publish({
destination: '/foo',
body: JSON.stringify({ data: message })
})
client.publish({
destination: '/foo2',
body: JSON.stringify({ data: message })
})
}
Console debug log:
[vite] connected.
+page.svelte?t=1732175300660:290 Opening Web Socket...
+page.svelte?t=1732175300660:290 Web Socket Opened...
+page.svelte?t=1732175300660:290 >>> CONNECT
accept-version:1.2,1.1,1.0
heart-beat:2000,2000
+page.svelte?t=1732175300660:290 Received data
+page.svelte?t=1732175300660:290 <<< CONNECTED
server:vertx-stomp/4.5.11
content-length:79
+page.svelte?t=1732175300660:290 connected to server vertx-stomp/4.5.11
+page.svelte?t=1732175300660:290 >>> SUBSCRIBE
id:sub-0
destination:/foo
+page.svelte?t=1732175300660:290 >>> SUBSCRIBE
id:sub-1
destination:/foo2
+page.svelte?t=1732175300660:290 Received data
+page.svelte?t=1732175300660:290 <<< PONG
+page.svelte?t=1732175300660:290 Received data
+page.svelte?t=1732175300660:290 <<< PONG
+page.svelte?t=1732175300660:290 Received data
+page.svelte?t=1732175300660:290 <<< PONG
+page.svelte?t=1732175300660:290 Connection closed to ws://localhost:8082/stomp
Here the binary frame send by the server
CONNECTED
server:vertx-stomp/4.5.11
heart-beat:4000,5000
session:0d448c28-ba29-4a5b-80fb-ccaa3c9d3a83
version:1.2
Ok i found the responsible code: It will stop at the first considered headers maybe there is too much \n from the server ?
So in my case it was related to mt server so it was not a bug
Thanks for the detailed report. I am closing this issue.
Hi in below environment, seems like out-going heartbeat(PING) from the client is not working after establishing a connect with the backend server. I have enabled the debugging as per the documents. But, seems like it's not showing Heartbeat messages as it's not being sent to the backend server. Need some support here. FYI, the polyfills have been enabled after reading the FAQs
Environment
0.74.5
7.0.0
Code