Websocket no longer listens to events and no error returns.

Project Id: 32e7c04c-c58a-41a6-9e8c-320a473294f7 Dear Railway Support, I hope this message finds you well. I am writing to report a problem with my websocket server, which has stopped listening to events and does not return any errors. Despite this, the get headers always show a status of 200. I have considered several possible avenues for investigation, including an error occurring when opening the binding with the client or the websocket destroying the connection without restarting it. As a temporary solution, I have tried restarting the server, but this has not resolved the issue. Unfortunately, there is no information in the logs that indicates what is causing the problem. I would greatly appreciate any assistance you could provide in resolving this issue, as it is impacting my ability to effectively use the websocket server.
wssProvider._websocket.on('open', () => {
keepAliveInterval = setInterval(() => {
if (isPrintLogs)
console.log(
`Checking if the connection is alive, sending a ping on ${network} with the ${providerName} provider`
)

wssProvider._websocket.ping()

// `WebSocket#terminate()`, which immediately destroys the connection,
pingTimeout = setTimeout(() => {
console.error(`Terminate websocket ${providerName} on ${network}`)
wssProvider._websocket.terminate()
}, EXPECTED_PONG_BACK)
}, KEEP_ALIVE_CHECK_INTERVAL)
})
wssProvider._websocket.on('open', () => {
keepAliveInterval = setInterval(() => {
if (isPrintLogs)
console.log(
`Checking if the connection is alive, sending a ping on ${network} with the ${providerName} provider`
)

wssProvider._websocket.ping()

// `WebSocket#terminate()`, which immediately destroys the connection,
pingTimeout = setTimeout(() => {
console.error(`Terminate websocket ${providerName} on ${network}`)
wssProvider._websocket.terminate()
}, EXPECTED_PONG_BACK)
}, KEEP_ALIVE_CHECK_INTERVAL)
})
It is possible that the issue with your websocket server could be related to this code. If the websocket connection is being terminated for some reason, the server will not be able to receive events until a new connection is established. To diagnose the issue, you may want to log the state of the websocket connection at different points in the code and see if the terminate() function is being called unexpectedly. Thank you for your time and attention to this matter. Sincerely, Yannick.
4 Replies
Percy
Percy2y ago
Project ID: 32e7c04c-c58a-41a6-9e8c-320a473294f7
Yannick
Yannick2y ago
My websocket sleeps like when a serverless node.js app shuts down after some time of inactivity. Unlike a serverless, no broken or complaining my websocket which has a KEEP_ALIVE_CHECK_INTERVAL stays in deep sleep. Do you have an idea ? Could it be an nginx program shutdown with a proxy timeout?
yann
yann2y ago
I've got the same problem. Did you find a solution? I am using a custom domain already
Want results from more Discord servers?
Add your server