On 11/6/12 3:41 PM, Danny Coward wrote:
> On 11/2/12 5:36 PM, Scott Ferguson wrote:
>> On 11/2/12 4:59 PM, Danny Coward wrote:
>>> Hi folks,
>>>
>>> Another question that has come up as people look at the API and
>>> implement it is the issue of precedence when an endpoint has
>>> multiple MessageHandlers. I wrote up a little proposal that seeks to
>>> define how the container is supposed to select which of potentially
>>> numerous of MessageHandlers to callwhen a web socket message arrives.
>>
>> I've been working through this in our implementation. (Decoders is a
>> different/related/bigger issue.)
>>
>> More comments inline, but the summary is I think it's best to only
>> allow one Text handler and one Binary handler, and throw an
>> IllegalStateException at registration time if more than one of each
>> type is registered.
> Yeah I think I agree with everyone: what I wrote up is too complicated.
>
> But let me make sure I understand, are you thinking that you'd only
> allow one of any of the several different text-message handlers:
> {MessageHandler.Text, MessageHandler.AsyncText,
> MessageHandler.DecodedObject<T> with Decoder.Text<T> or
> Decoder.TextStream<T>} to be registered per connection, and one of the
> several different binary-message handlers {analogous list} to be
> registered ? So you can have at most two handlers per connection, and
> the developer has to pick his mode of consumption for both text and
> binary?
Yes. That's what I was thinking.
In practice, I'd expect most sub-protocols would be either text or
binary but not both. (Not enforced, of course.)
-- Scott