This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I have a godot server build that use websocket client connect to my python server.
Everything are fine but when godotserver keep running over few hours, my websocket server show it disconnected( I also terminate the ws server to ensure) and godotserver any ws closed/error not detected but I can sure it still calling the poll()

extends Node

var websocket = WebSocketClient.new()
var websocketHost = "myhost.com"
var connecting = false
var last_print_minute = -1

# Called when the node enters the scene tree for the first time.
func _ready():
    websocket.verify_ssl = false
    websocket.connect("connection_established", self, "on_connected")
    websocket.connect("data_received", self, "on_data")
    websocket.connect("server_close_request", self, "on_server_close")
    websocket.connect("connection_closed", self, "on_connection_closed")
    websocket.connect("connection_error", self, "on_connection_error")
    connecting = true
    websocket.connect_to_url("ws://"+websocketHost)

func _process(delta):
    var time = OS.get_datetime()
    if time['minute']!=last_print_minute:
        last_print_minute = time['minute']
            print("[", time['year'], "-", time['month'], "-", time['day'], " ", time['hour'], ":", time['minute'], ":", time['second'], "] is_connecting=", connecting)
    if connecting:
        websocket.poll()

func on_connected(protocol):
    print("connected")

func on_server_close (code, reason):
    print("server request closed")

func on_connection_closed( was_clean_close ):
    print("connection closed")
    connecting = false
    get_tree().quit()

func on_connection_error():
    print("connection error")
    connecting = false
    get_tree().quit()

After server terminated, godot still printing timestamp but never print any closed or quit
This happen everytime after few hours, I record once => running for 25,126 seconds and server side show that disconnected
Any idea?

in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.