FredyH / GWSockets

WebSockets for GLua
MIT License
87 stars 7 forks source link

Disconnecting after 30-60s #39

Closed Zoom-Developer closed 4 months ago

Zoom-Developer commented 4 months ago

After connecting my websocket disconnecting after +- 30-60s, with server all correct, why that can happened?

w.connect = function()
        w.ws = GWSockets.createWebSocket(url)

        function w.ws:onMessage(msg)
            w.onMessage(msg)
        end
        function w.ws:onConnected()
            w.connected = true
            w.onConnected()
        end
        function w.ws:onDisconnected()
            w.connected = false
            w.onDisconnected()
        end

        w.ws:open()
    end
FredyH commented 4 months ago

You likely have to keep the connection alive by sending any message every 30 seconds, otherwise the server thinks your socket has disconnected.

Zoom-Developer commented 4 months ago

Strange, the server doesnt need a keepalive messages, but if I write "echo" every 15s, connection doesnt terminating...