My understanding is that to establish a persistent socket connection using socket.io the Node.js server should be always running. With Google Cloud Functions there isn't an always running Node.js server, so keeping a socket connection alive is not possible.
Is Cloud Run with a running Node.js server the best option to handle multiple socket connections using socket.io ?
cloud run doesn't have support for ingress web-socket messages.
There is no concept on a forever-running function on Cloud Functions (nor on other, similar Functions-as-a-Service offerings), although it's definitely possible to create a function that gets triggered every minute or so (like a cron job). This user is first on the weekly Google Cloud leaderboard.
"Realtime backend made easy", "Fast and responsive" and "Easy setup" are the key factors why developers consider Firebase; whereas "Real-time", "Event-based communication" and "Node. js" are the primary reasons why Socket.IO is favored.
UPDATE: From January 2021, GCP Cloud Run supports WebSockets.
Here is the link to the Cloud Run documentation
Here is the link to the blog post (their announcement)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With