jsr356-experts@websocket-spec.java.net

[jsr356-experts] Pings and Pongs

From: Danny Coward <danny.coward_at_oracle.com>
Date: Thu, 12 Jul 2012 16:24:10 -0700

Hi folks,

My (re-)read of the web socket RFC sections on Pings and Pongs
(http://tools.ietf.org/html/rfc6455#section-5.5.2) tells me that:

- applications should be able to send pings at will 'as a keepalive or
to verify responsiveness'
- pings can have application data in them
- an active endpoint MUST send back a pong if it gets a ping as soon as
possible
- the pong must have the same application data as the ping.

So it looks to me that for the JSR API, this means:-

a) API to send pings, something like: public void sendPing(byte[]
applicationData) on RemoteEndpoint.
b) A ping-pong should reset the idle timeout on the connection.
c) API to receive pongs, something like: public void onPong(byte[]
applicationData) on MessageListener
d) implementations should answer a ping with a pong with the same data
as soon as possible after receiving it.

Any other thoughts ?

- Danny

-- 
<http://www.oracle.com> 	*Danny Coward *
Java EE
Oracle Corporation