Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | hanley_chen |
func _ready():
ws = WebSocketClient.new()
ws.connect("connection_established", self, "_connection_established")
ws.connect("connection_closed", self, "_connection_closed")
ws.connect("connection_error", self, "_connection_error")
var url = "ws://localhost:8080"
print("Connecting to " + url)
ws.connect_to_url(url)
func _connection_established(protocol):
print("Connection Established With Protocol: ", protocol)
func _connection_closed():
print("Connection Closed")
func _connection_error():
print("Connection Error")
func _process(delta):
if ws.get_connection_status() == ws.CONNECTION_CONNECTING || ws.get_connection_status() == ws.CONNECTION_CONNECTED:
ws.poll()
it is okay when i connect to local node server.
but when i deploy on heroku, and turn the URL var into “https://gdwebsocketdemo.herokuapp.com/”
it come out with an error:
The argument ‘delta’ is never used in the function ‘_process’
getaddrinfo failed! Cannot resolve hostname
Condition ‘!addr.is_invalid()’ is true. returned: ERR_INVALID_PARAMETER
since i don’t have a fully understanding on websocketclient usage. what might be the issue. thank you.
btw. it’s an examples of gd-com-utils provided by Salsa2K.