Versions: Nakama 3.35.1
Hi friends,
We are opening a socket to receive notifications to the client from the server. As soon as we open this connection it is being terminated immediately and I’m not sure why!
The connection is established successfully, but is closed instantly.
The client is built in Godot, see client code snippet below. _socket is not a local variable and is not going out of scope, it lives on this node for the duration of the app’s lifetime.
Asking our AI overlords they suggest it is related to the hosting environment which is Fly.io and the configuration of our Fly app there - this is where my understanding starts to break down ![]()
// Fly app configuration
[[services]]
internal_port = 7350
protocol = "tcp"
[[services.ports]]
handlers = ["tls"]
port = 443
[[services]]
internal_port = 7351
protocol = "tcp"
[[services.ports]]
handlers = ["tls"]
port = 7351
// Client snippet
func _connectToSocket() -> bool:
_socket = Nakama.create_socket_from(_client)
var connected : NakamaAsyncResult = await _socket.connect_async(_nakamaClient.GetAuthManager().Session())
if connected.is_exception():
printerr(connected.exception)
return false
_socket.received_notification.connect(_on_notification)
return true
// Nakama logs
11:54:42 {"level":"info","ts":"2026-01-30T11:54:42.443Z","caller":"server/session_ws.go:84","msg":"New WebSocket session connected","uid":"527957b5-c96e-40c0-9fec-a5cc20a66dda","sid":"76ac0df8-fdd2-11f0-aecd-006100a0eb06","format":0}
11:54:42 [PP02] could not proxy TCP data to/from instance: failed to copy (direction=client->server, op=read, error=peer closed connection without sending TLS close_notify: https://docs.rs/rustls/latest/rustls/manual/_03_howto/index.html#unexpected-eof)
Any help is greatly appreciated, thanks very much!