fix: update Godot websocket handshake API

This commit is contained in:
Josh Creek
2026-09-01 08:21:05 +01:00
parent 467c25b20c
commit 76aad61191
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -1,4 +1,3 @@
class_name ControlPlaneClient
extends Node
# Authenticated HTTP boundary for matchmaking. ENet/Steam carries the match
@@ -92,7 +91,11 @@ func connect_event_stream() -> Error:
return ERR_UNAUTHORIZED
var socket_url := websocket_url(base_url) + "/v1/events"
_websocket = WebSocketPeer.new()
var err := _websocket.connect_to_url(socket_url, PackedStringArray(["Authorization: Bearer " + access_token]))
# Godot 4.7 moved handshake headers onto WebSocketPeer; the second
# connect_to_url argument is TLSOptions, not an HTTP header array. Keep the
# bearer token in the authenticated handshake without putting it in the URL.
_websocket.handshake_headers = PackedStringArray(["Authorization: Bearer " + access_token])
var err := _websocket.connect_to_url(socket_url)
if err != OK:
_set_websocket_status("DISCONNECTED")
return err