Hi!
Question to the experts: Is keep-alive for the Websockets TCP connection automatically done by the Websockets Layer (client or server), or do I have to do it manually (nathelper pinging).
Thanks Klaus
Klaus Darilion writes:
Question to the experts: Is keep-alive for the Websockets TCP connection automatically done by the Websockets Layer (client or server), or do I have to do it manually (nathelper pinging).
since websockets uses tcp, kamailio running on linux should automatically do tcp level keepalives.
-- juha
The Kamailio websocket module sends WebSocket pongs in response to WebSocket pings from websocket clients. It can also be configured to send WebSocket pings on idle connections (and does so by default).
There is no TCP level stuff here, this is all at the WebSocket layer. Take a look at the "keepalive_.*" modparams for the websocket module.
The TCP connection timeout should be set to something a little greater than the WebSocket ping interval is set to.
Regards,
Peter
On 26 September 2013 12:37, Juha Heinanen jh@tutpro.com wrote:
Klaus Darilion writes:
Question to the experts: Is keep-alive for the Websockets TCP connection automatically done by the Websockets Layer (client or server), or do I have to do it manually (nathelper pinging).
since websockets uses tcp, kamailio running on linux should automatically do tcp level keepalives.
-- juha
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Thanks for the info.
btw: Can you recommend a HTML/JS SIP client (open source) for testing purposes? I have written a very limited client based on JsSIP, but now I need some more features for testing and my research did not revealed a nice client.
Thanks Klaus
On 26.09.2013 14:07, Peter Dunkley wrote:
The Kamailio websocket module sends WebSocket pongs in response to WebSocket pings from websocket clients. It can also be configured to send WebSocket pings on idle connections (and does so by default).
There is no TCP level stuff here, this is all at the WebSocket layer. Take a look at the "keepalive_.*" modparams for the websocket module.
The TCP connection timeout should be set to something a little greater than the WebSocket ping interval is set to.
Regards,
Peter
On 26 September 2013 12:37, Juha Heinanen <jh@tutpro.com mailto:jh@tutpro.com> wrote:
Klaus Darilion writes: > Question to the experts: Is keep-alive for the Websockets TCP connection > automatically done by the Websockets Layer (client or server), or do I > have to do it manually (nathelper pinging). since websockets uses tcp, kamailio running on linux should automatically do tcp level keepalives. -- juha _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org <mailto:sr-users@lists.sip-router.org> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Peter Dunkley Technical Director Crocodile RCS Ltd
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Peter Dunkley writes:
There is no TCP level stuff here, this is all at the WebSocket layer. Take a look at the "keepalive_.*" modparams for the websocket module.
are you saying that websocket transport is not implemented on top of tcp?
if it is then tcp_keepalive=yes core param affects also websocket transport.
-- juha
tcp_keepalive=yes has an effect on the underlying TCP connection. However, simply keeping the TCP connection alive will not stop the client or server WebSocket implementation explicitly closing the connection if no WebSocket frames are received.
If you are using WebSockets, and you are unsure as to the behaviour of the WebSocket client (some clients will send pings themselves and some won't - it's an implementation choice) the WebSocket server should send pings on idle connections that need to be kept open. If you want to make sure the underlying TCP connection doesn't go on you then you need to set the TCP connection parameters accordingly (the way I do it is to set the TCP connection timeout to a few seconds more than the WebSocket ping interval) - and do so for all LAN equipment in the path.
A good example is that if you are using Amazon Elastic Load-Balancer to distribute WebSocket connections, idle connections will be timed-out (by the Load-Balancer) after 60 seconds - so make sure the server sends WebSocket pings more frequently than that.
Regards,
Peter
On 26 September 2013 14:21, Juha Heinanen jh@tutpro.com wrote:
Peter Dunkley writes:
There is no TCP level stuff here, this is all at the WebSocket layer.
Take
a look at the "keepalive_.*" modparams for the websocket module.
are you saying that websocket transport is not implemented on top of tcp?
if it is then tcp_keepalive=yes core param affects also websocket transport.
-- juha
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Peter Dunkley writes:
A good example is that if you are using Amazon Elastic Load-Balancer to distribute WebSocket connections, idle connections will be timed-out (by the Load-Balancer) after 60 seconds - so make sure the server sends WebSocket pings more frequently than that.
peter,
websocket readme has this:
4.1. keepalive_mechanism (integer)
The keep-alive mechanism to use for WebSocket connections.
Note
If nathelper is only being used for WebSocket connections then nathelper NAT pinging is not required. If nathelper is used for WebSocket connections and TCP/TLS aliasing/NAT-traversal then WebSocket keep-alives are not required.
based on what you write now, is the above readme text still valid, i.e., are nat pings enough to prevent amazon load balancer from timing out websocket connections or are native websocket pings needed instead?
-- juha
The Kamailio WebSocket stack will only ping on idle connections. If nathelper is sending SIP level pings on a shorter interval than the WebSocket stack is the connection won't be considered idle. The load-balancer doesn't understand the TCP traffic so it won't care as long as there is traffic.
However, it would seem silly to me to use nathelper pings over the WebSocket transport (unless you already have them enabled for another transport) as it is more efficient just to let the WebSocket layer take care of it. After all, the nathelper pings from Kamailio are something of work-around that pre-dates RFC 5626. Under outbound it's quite clear that if SIP-level keep-alives are needed for a particular transport the UA should do it, not the server.
Regards,
Peter
On 26 September 2013 14:55, Juha Heinanen jh@tutpro.com wrote:
Peter Dunkley writes:
A good example is that if you are using Amazon Elastic Load-Balancer to distribute WebSocket connections, idle connections will be timed-out (by the Load-Balancer) after 60 seconds - so make sure the server sends WebSocket pings more frequently than that.
peter,
websocket readme has this:
4.1. keepalive_mechanism (integer)
The keep-alive mechanism to use for WebSocket connections.
Note
If nathelper is only being used for WebSocket connections then nathelper NAT pinging is not required. If nathelper is used for WebSocket connections and TCP/TLS aliasing/NAT-traversal then WebSocket keep-alives are not required.
based on what you write now, is the above readme text still valid, i.e., are nat pings enough to prevent amazon load balancer from timing out websocket connections or are native websocket pings needed instead?
-- juha
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
The Kamailio websocket module sends WebSocket pongs in response to WebSocket pings from websocket clients. It can also be configured to send WebSocket pings on idle connections (and does so by default).
There is no TCP level stuff here, this is all at the WebSocket layer.
Regards,
Peter
On 26 September 2013 12:37, Juha Heinanen jh@tutpro.com wrote:
Klaus Darilion writes:
Question to the experts: Is keep-alive for the Websockets TCP connection automatically done by the Websockets Layer (client or server), or do I have to do it manually (nathelper pinging).
since websockets uses tcp, kamailio running on linux should automatically do tcp level keepalives.
-- juha
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users