jsr356-experts@websocket-spec.java.net

[jsr356-experts] Multiple Encoders of same Type

From: Joakim Erdfelt <joakim_at_intalio.com>
Date: Wed, 17 Sep 2014 06:01:09 -0700

Looking for some clarification on this scenario.

A ServerEndpoint with 2 decoders and 2 encoders defined.

Encoders:

  1) AppleTextEncoder implements Encoder.Text<Apple>
  2) AppleBinaryEncoder implements Encoder.Binary<Apple>

If the following happens ...

session.getBasicRemote().sendObject(new Apple());

What kind of message is that on the protocol? TEXT or BINARY?
In Jetty, we fail the deployment of this endpoint, as this is an ambiguous
scenario. (We report a duplicate ambiguous encoder)
We've received support from users in several camps of opinion for either
failing, or making a best guess, defaulting to text in case of conflict, to
even just using whatever is defined first in the encoder list.

Looking through the mailing lists, and issues on the WEBSOCKET-SPEC jira,
there doesn't seem to be any policy defined for this.

This kind of nuance isn't a big deal for Decoders.

--
Joakim Erdfelt <joakim_at_intalio.com>
webtide.com <http://www.webtide.com/> - intalio.com/jetty
Expert advice, services and support from from the Jetty & CometD experts
eclipse.org/jetty - cometd.org