WebSocket client API
Wenbo Zhu
wenboz at google.com
Thu Oct 1 01:02:50 UTC 2015
Thanks for sharing this, and my initial feedback as following:
===
Optionally, keep the API simpler and match the JS API (W3C)
1. remove sendAsync .. send() should be async **
2. remove suspend/resume
3. do not involve HTTPClient and support explicit handshake methods
4. remove createAsync ... and create() should be async, with an onOpen
callback
** leave flow-control completely to applications ...
===
Alternatively or additionally: support "standard" blocking I/O, e.g.
WebSocketInputChannel WebSocket.getInputChannel()
WebSocketOutputChannel WebSocket.getOutputChannel)
interface WebSocketChannel extends InterruptableChannel
===
Style issues
1. keep Incoming and Chunks two separate APIs?
2. is OutGoing necessary? Is it better to have 4 overloaded send() methods?
===
Nice to have:
1. expose ping-pong messages
On Mon, Aug 31, 2015 at 7:30 AM, Pavel Rappo <pavel.rappo at oracle.com> wrote:
> Hi,
>
> I would appreciate if you help to review a WebSocket client API proposed
> for
> JDK 9. This work is a part of JEP-110 [1] and has started its public path
> with
> HTTP client review in March this year [2].
>
> Proposed WebSocket API is relatively small and focuses on convenient
> exchange of
> data in a fully asynchronous fashion. API consists of 6 types located in
> the
> java.net package [3]:
>
> 1. WebSocket
> 2. WebSocket.Builder
> 3. WebSocket.Incoming
> 4. WebSocket.Incoming.Chunks
> 5. WebSocket.Outgoing
> 6. WebSocketException
>
> Starting point is a class description for java.net.WebSocket. Along with
> in-javadoc examples, several API test samples are provided in the webrev
> [4] and
> named test/java/net/WebSocket/Example%.java. They are only for
> informational
> purposes and won't be included in the final version of the API.
>
> I would appreciate any feedback on this API. Thanks.
>
>
> -------------------------------------------------------------------------------
> [1] http://openjdk.java.net/jeps/110
> [2] http://mail.openjdk.java.net/pipermail/net-dev/2015-March/008932.html
> [3] http://cr.openjdk.java.net/~prappo/8087113/javadoc.00/
> [4] http://cr.openjdk.java.net/~prappo/8087113/webrev.00/
>
> -Pavel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/net-dev/attachments/20150930/ac708e07/attachment.html>
More information about the net-dev
mailing list