Fly.toml configuration for a very simple Socket.IO server

I’m trying to deploy a very simple Websocket server for a Next.js client that I have hosted on Vercel.
All works on my local machine, but I cannot for the life of me get to connect to the Socket.IO server once I deploy it on Fly.
My only thoughts about it is that it could be the fly.toml file, since I’m not too familiar with how to configure that.
This is my current config (only the relevant part of the toml):

[[services]]
  internal_port = 8080
  protocol = "tcp"

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20

  [[services.ports]]
    handlers = ["http"]
    port = "80"

  [[services.ports]]
    handlers = ["tls", "http"]
    port = "443"

  [[services.tcp_checks]]
    interval = 10000
    timeout = 2000

I double checked my logs, sometimes I also get this for whatever reason:

[error] Health check on port 8080 has failed. Your app is not responding properly. Services exposed on ports [80, 443] will have intermittent failures until the health check passes.

hey @Arrhythmia, what port is your websocket server listening on inside the VM?
In the fly.toml, internal_port is set to 8080, are you also listening on 8080?

Yes, listening to 8080. Before that I tried 3000 and obviously changed it both in toml and in the server, still nothing (And yes the port is specified in the client that’s trying to connect as well)

Ok that’s strange. Are you listening on IP 0.0.0.0 though?
You need to explicitly listen on 0.0.0.0 in order for us to run health checks against your app. See this

Also if your server takes some time to boot, you should consider adding a grace_period to your tcp_checks block.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.