lua-users home
lua-l archive

RE: websocket client lib with KEEPALIVE support

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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: lua-l-bounces@lists.lua.org <lua-l-bounces@lists.lua.org> On Behalf Of Oliver Kroth
Sent: Monday, December 31, 2018 9:35 AM
To: lua-l@lists.lua.org
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

AltStyle によって変換されたページ (->オリジナル) /