about summary refs log tree commit diff stats
path: root/Archipelago
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-05-05 15:12:36 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-05 15:12:36 -0400
commit574922e37337690b4499427ea42ba12985ac9bee (patch)
tree7cdfb9be86a986848a522626012a3e60dd28d0aa /Archipelago
parent5ffe823397bf047b366ac0be07388c5f36f05ccb (diff)
downloadlingo-archipelago-574922e37337690b4499427ea42ba12985ac9bee.tar.gz
lingo-archipelago-574922e37337690b4499427ea42ba12985ac9bee.tar.bz2
lingo-archipelago-574922e37337690b4499427ea42ba12985ac9bee.zip
Added wss support
Diffstat (limited to 'Archipelago')
-rw-r--r--Archipelago/client.gd30
1 files changed, 23 insertions, 7 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index a1ba64d..b7050b6 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd
@@ -45,6 +45,7 @@ const kREARRANGE_PANELS = 1
45var _client = WebSocketClient.new() 45var _client = WebSocketClient.new()
46var _should_process = false 46var _should_process = false
47var _initiated_disconnect = false 47var _initiated_disconnect = false
48var _try_wss = false
48 49
49var _datapackages = {} 50var _datapackages = {}
50var _pending_packages = [] 51var _pending_packages = []
@@ -134,13 +135,17 @@ func _reset_state():
134 135
135 136
136func _errored(): 137func _errored():
137 global._print("AP connection failed") 138 if _try_wss:
138 _reset_state() 139 global._print("Could not connect to AP with ws://, now trying wss://")
140 connectToServer()
141 else:
142 global._print("AP connection failed")
143 _reset_state()
139 144
140 emit_signal( 145 emit_signal(
141 "could_not_connect", 146 "could_not_connect",
142 "Could not connect to Archipelago. Check that your server and port are correct. See the error log for more information." 147 "Could not connect to Archipelago. Check that your server and port are correct. See the error log for more information."
143 ) 148 )
144 149
145 150
146func _closed(_was_clean = true): 151func _closed(_was_clean = true):
@@ -155,6 +160,7 @@ func _closed(_was_clean = true):
155 160
156func _connected(_proto = ""): 161func _connected(_proto = ""):
157 global._print("Connected!") 162 global._print("Connected!")
163 _try_wss = false
158 164
159 165
160func disconnect_from_ap(): 166func disconnect_from_ap():
@@ -440,7 +446,17 @@ func getSaveFileName():
440func connectToServer(): 446func connectToServer():
441 _initiated_disconnect = false 447 _initiated_disconnect = false
442 448
443 var url = "ws://" + ap_server 449 var url = ""
450 if ap_server.begins_with("ws://") or ap_server.begins_with("wss://"):
451 url = ap_server
452 _try_wss = false
453 elif _try_wss:
454 url = "wss://" + ap_server
455 _try_wss = false
456 else:
457 url = "ws://" + ap_server
458 _try_wss = true
459
444 var err = _client.connect_to_url(url) 460 var err = _client.connect_to_url(url)
445 if err != OK: 461 if err != OK:
446 emit_signal( 462 emit_signal(