Question

Server cannot send messages through websocket connection after 5 minutes

I have a Node.js app deployed through App Platform using a custom Dockerfile and I am using https://www.npmjs.com/package/ws as a standalone server to support websocket. Locally it’s working fine with a system of ping-pong system to keep the connective alive. In production, it’s also working fine the connection between the client and the server is kept but when the server is not able to send any message after 5 minutes.

Is there any limitations I am not aware of? I tried to look for Cloudflare possible issues, it may be there but I am not sure.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
April 6, 2024
Accepted Answer

Hey!

This is quite interesting, what I usually do is to follow the steps here on how to deploy an app using Websockets to the DigitalOcean App Platform:

https://docs.digitalocean.com/developer-center/deploy-an-app-using-websockets-to-app-platform/

It seems like your GitHub repository is not public, if you make it public I will be happy to try and deploy the project and further look into what might be going on!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel