jsr356-experts@websocket-spec.java.net

[jsr356-experts] Re: Client API: was Re: Ideas for narrowing scope

From: Scott Ferguson <ferg_at_caucho.com>
Date: Mon, 19 Nov 2012 11:06:45 -0800

On 11/19/12 10:25 AM, Scott Ferguson wrote:
> On 11/14/12 5:56 PM, Danny Coward wrote:
>> OK, how about:-
>>
>> Bootstrap API
>> ClientContainer.connectToServer(Endpoint e) // Endpoint carries own
>> config object which includes the URL
>> ClientContainer.connectToServer(Object pojo, URL path) // pojo
>> deployment, absolute URL separated from POJO/annotation
>>
>> Annotation ClientWebSocket
>> String[] subprotocols() default {}; // the subprotocols the
>> client wants
>> Class<? extends Decoder>[] decoders() default {}; // installed
>> decoders (thanks Joakim for generifying this)
>> Class<? extends Encoder>[] encoders() default {}; // installed
>> encoders
>
> 1) This looks good. I just refactored with this change and it works
> fine. I assume you're planning on changing URL to String to match the
> DefaultClientConfiguration?

Oh, I just remembered. To allow programmatic close(), it might be good
to return the Session from the connectToServer(). That session would
allow the calling code to close the client. Otherwise it needs to ask
the endpoint to close the connection through the session.

-- Scott