websocket client lib with KEEPALIVE support

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

websocket client lib with KEEPALIVE support

murthy
I see a few lua websocket client libs out there. Please let me know if there
is one with KEEPALIVE support that is recommended.



--
Sent from: http://lua.2524044.n2.nabble.com/Lua-l-f2524044.html

Reply | Threaded
Open this post in threaded view
|

Re: websocket client lib with KEEPALIVE support

Daurnimator
On Mon, 31 Dec 2018 at 14:58, murthy <[hidden email]> wrote:
>
> I see a few lua websocket client libs out there. Please let me know if there
> is one with KEEPALIVE support that is recommended.

By "keepalive" do you mean ping/pong?

lua-http will send pongs for you automatically.
There is also a :send_ping method if you want to send one yourself.
https://daurnimator.github.io/lua-http/0.2/#http.websocket

Reply | Threaded
Open this post in threaded view
|

Re: websocket client lib with KEEPALIVE support

murthy
I was referring to the KEEP ALIVE option so that the TCP connection is kept
around (with a timeout) between multiple websocket send's (and avoid the
conn setup/teardown for each send).



--
Sent from: http://lua.2524044.n2.nabble.com/Lua-l-f2524044.html

Reply | Threaded
Open this post in threaded view
|

Re: websocket client lib with KEEPALIVE support

Daurnimator
On Mon, 31 Dec. 2018, 16:45 murthy <[hidden email] wrote:
I was referring to the KEEP ALIVE option so that the TCP connection is kept
around (with a timeout) between multiple websocket send's (and avoid the
conn setup/teardown for each send).



--
Sent from: http://lua.2524044.n2.nabble.com/Lua-l-f2524044.html

Websockets do not set up a new connection for each frame. Sounds like you've been mislead at some point...
Reply | Threaded
Open this post in threaded view
|

Re: websocket client lib with KEEPALIVE support

Oliver Kroth
In reply to this post by murthy

> I see a few lua websocket client libs out there. Please let me know if there
> is one with KEEPALIVE support that is recommended.
>
TCP keep-alive is to detect a broken connection. It can be enabled with
the LuaSocket library and setsocket( 'keepalive', true )
WebSocket keep alive (PING - PONG) does the same two layers higher. This
may be implemented in the WebSocket library or application.

The latter is the more reliable operation as TCP keep-alive may be
spoofed by, e.g. routers.

--
Oliver

Reply | Threaded
Open this post in threaded view
|

RE: websocket client lib with KEEPALIVE support

Tim McCracken
We may have some confusion between "TCP keepalive" which is used to maintain a TCP session (and detect the loss of same)    and "HTTP Keep-alive" which is used to serve multiple HTTP requests using a single HTTP session rather than closing the connection after each HTTP request.

It is possible that HTTP keep-alive could unknowingly trigger TCP keepalive - but the two are not related and occur at different layers in the stack.

There are fairly decent articles on both here:

https://en.wikipedia.org/wiki/Keepalive
https://en.wikipedia.org/wiki/HTTP_persistent_connection



-----Original Message-----
From: [hidden email] <[hidden email]> On Behalf Of Oliver Kroth
Sent: Monday, December 31, 2018 9:35 AM
To: [hidden email]
Subject: Re: websocket client lib with KEEPALIVE support


> I see a few lua websocket client libs out there. Please let me know if
> there is one with KEEPALIVE support that is recommended.
>
TCP keep-alive is to detect a broken connection. It can be enabled with the LuaSocket library and setsocket( 'keepalive', true ) WebSocket keep alive (PING - PONG) does the same two layers higher. This may be implemented in the WebSocket library or application.

The latter is the more reliable operation as TCP keep-alive may be spoofed by, e.g. routers.

--
Oliver