How to setup a WebSocketServer on Google Cloud Platform VM?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By smithminy


I am running a server.pck as a Godot Server on my GCP VM instance.

var server =

I am running a seperate client.html currently from my local machine, attempting to connect to:

var client =
var url = "ws://" + ip + ":" + str(port)
print("attempting to connect to " + url)

The IP specified when trying to connect is the external IP of the GCP instance.

This all works using “localhost”, but doesn’t when using GCP. Do I need to do anything else to run a WebSocketServer through GCP?

Using “netstat -ano | grep 4444” I get:

 tcp6       0      0 :::4444    :::*     LISTEN      off (0.00/0/0)


:bust_in_silhouette: Reply From: yrtv
  1. Configure instance firewall to allow incoming on port 4444
  2. Configure account wide rules to allow incoming connections to GCP VM instance.

I do not use Google cloud, but I used Oracle’s free tier for thing’s like this

For Oracle cloud, this will be the following:

  1. Install firewalld (Oracle custom kernel do not work with ufw)
  2. Use fiewalld cli to open ports.
    3 In account dashboard create Internet Gateway connected to Virtual Cloud Network instance is on. (Virtual Cloud Network created for you. Virtual Cloud Network you must create yourself to allow external access to instances on Virtual Cloud Network)