From 2ed7ad2ba9998ddfe3038ee46deff814cbeb26f2 Mon Sep 17 00:00:00 2001 From: dingo Date: Sat, 28 Feb 2026 20:03:10 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20WebSocket=201009=20=E2=80=94=20increase?= =?UTF-8?q?=20Godot=20receive=20buffer=20and=20NATS=20max=20payload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Godot's WebSocketPeer.inbound_buffer_size defaults to 65535 bytes (64 KB). content.sync.ack for a full card catalog (200 cards with assets and animation bindings) exceeds this, causing Godot to close the connection with code 1009 "Message too big" every time content.sync is called. - Network.gd: set inbound_buffer_size = 4 MB before connect_to_url so the client can receive large sync responses without dropping the connection. - deployment-nats.yaml: raise NATS max_payload from 1 MB to 8 MB (-max_payload 8388608) so the content service can reply with large card batches through NATS without hitting a publish-too-large error as the card catalog grows. Note: NATS pod needs a rollout restart to apply the new max_payload arg: kubectl rollout restart deployment/nats -n stone-server Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- Client/origin-client/autoloads/Network.gd | 3 +++ deploy/k8s/deployment-nats.yaml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Client/origin-client/autoloads/Network.gd b/Client/origin-client/autoloads/Network.gd index 8ea5d0b..4b2118e 100644 --- a/Client/origin-client/autoloads/Network.gd +++ b/Client/origin-client/autoloads/Network.gd @@ -126,6 +126,9 @@ func is_online() -> bool: func _connect_now() -> void: _ws = WebSocketPeer.new() + # content.sync.ack for a full card catalog can be several hundred KB. + # Godot's default is 65535 bytes which triggers code 1009 on large responses. + _ws.inbound_buffer_size = 4 * 1024 * 1024 # 4 MB _state = _State.CONNECTING var err := _ws.connect_to_url(SERVER_URL) if err != OK: diff --git a/deploy/k8s/deployment-nats.yaml b/deploy/k8s/deployment-nats.yaml index b2ab911..b9a3c56 100644 --- a/deploy/k8s/deployment-nats.yaml +++ b/deploy/k8s/deployment-nats.yaml @@ -22,6 +22,8 @@ spec: - "-js" - "-m" - "8222" + - "-max_payload" + - "8388608" # 8 MB — allows large content.sync payloads through NATS ports: - name: client containerPort: 4222