0

I need to implement nodejs socketio multiplayer game servers. And these game servers run for only 5 mins when they are triggered. And my main question is:

Can I connect multiple users using socketio on the same Google Cloud Functions or Google Cloud Run http endpoints? If I can't what else services I can use for it?

lkhgvsuren
  • 11
  • 3

1 Answers1

0

You can’t use Cloud Functions or Cloud Run for your use case. This is due to the fact that they are not able to support persistent socket connections. If you want to use socket.io, you will need a backend where you have control on the server instance, so, something like App Engine Flex, Compute Engine or Kubernetes engine.

Here’s an official tutorial on how to set up a socket server on App Engine Flex. Here’s a Solution (GCP documentation) for a similar issue which tackles a few different approaches.

maniSidhu98
  • 527
  • 2
  • 9