users@websocket-spec.java.net

[jsr356-users] Re: _at_OnMessage once per endpoint?

From: Ricardo Cervera-Navarro <ricardo.cervera-navarro_at_oracle.com>
Date: Thu, 21 Mar 2013 14:59:22 -0700

Hi Mohamed, all,

The Javadoc (b81) for OnMessage says: "Each websocket endpoint may only
have one message handling method for each of the native websocket
message formats: text, binary and pong."

I had an example with several decoders and message types for text
messages. After this change, my example just became more complicated and
less clean: it made it harder to have different Java types for different
kinds of text messages, there is only one decoder but it is
significantly more complex, and my Endpoint class now has more
conditional clauses.

Could somebody share with us some of the reasons for the change?

Thanks,
--
Ricardo Cervera-Navarro
Technical Writer
On 3/14/2013 5:02 AM, Mohamed Taman wrote:
> Hi Andy,
>
> It is allowed to have more than @OnMessage per Endpoint. as in my code
> demo in JDC and it works with the same Glassfish b80 and Tyrus_b13.
>
> here is the code of endpoint, the 2 messages are in red.
>
> [...]
>
> On Thu, Mar 14, 2013 at 1:26 PM, Andy Moncsek <amo.ahcp_at_gmail.com
> <mailto:amo.ahcp_at_gmail.com>> wrote:
>
>     Hi,
>     I upgraded to glassfish b80 (tyrus 1.0-b13) today and realized
>     that only one @OnMessage works per Endpoint?! Can you confirm
>     this? I get a validation error from GF, so this seem to be a
>     wanted behavior. Also in tyrus SVN I can find comments like this:
>     "MessageHandler registration validity checking algorithm (also
>     applicable for annotated case).". So what was the reason to do so?
>     Do I really have to deal with generic messages to communicate with
>     one endpoint?
>
>     Thanks
>
>     Andy
>
>
>
>
> -- 
>
>  
>
> Thanks & Best Regards
>
>  
>
> “*/I/*/mprove your /*/Life/*/through *Science* and /*/Art/*/…”/
>
> Mohamed Mahmoud Taman
>
> /Business//Solutions,/
>
> /Systems Architect & Design Supervisor/
>
> /Java Team Leader/
>
> 	
>
> | JCP (Java Community Process) Member
> <http://jcp.org/en/participation/members/T>
>
> |Oracle Egypt Architects Club board member
>
> | JavaOne & EG-JDC Speaker
>
> | SCJP, SCWCD, OCP PL/SQL
>
>                                                                      
>                                    
>
> e-finance,BLDG17, Smart Village,
>
> KM 28 Cairo-Alex Desert Road,
>
> Ground Floor, Giza, Egypt
> */Postal Code :/*12577
>
> ( :  +(202) 3827 1422
>
> (:   +(202) 3827 1499
>
> (:   +(202) 3827 1599
>
> È:  +(201) 00531 8017
>
> *P****Before you print Think about Your ENVIRONMENTAL responsibility.***
>