users@tyrus.java.net

Re: websockets

From: Chuck Davis <cjgunzel_at_gmail.com>
Date: Wed, 27 Jul 2016 14:45:44 -0700

Hi Pavel:

No, my decoder implements Decoder.Binary<DOVariables>.

My only interest is exchanging objects -- no text.

My ClientEndpoint uses the following:
session.getBasicRemote().sendObject(DOVariables); The encoder is
apparently working as designed (at least it is getting called).

All the stuff I'm reading indicates it can be done but I can't find
out how. The API docs say it can be done. The JEE tutorial says it
can be done (with snippets I've used as a template)....Nothing so far
has worked.

As I mentioned, if I include an @OnMessage that takes a String I don't
get the exception but neither does the endpoint call my @OnMessage for
my DOVariables object. It just sends my object to the String handler.

Thanks.

On Wed, Jul 27, 2016 at 2:36 PM, Pavel Bucek <pavel.bucek_at_oracle.com> wrote:
> Hi Chuck,
>
> you might want to take a look at Tyrus "auction" sample, more concretely
> AuctionEndpoint:
>
> https://github.com/tyrus-project/tyrus/blob/master/samples/auction/src/main/java/org/glassfish/tyrus/sample/auction/AuctionEndpoint.java
>
> "Text message handler not found." usually means that the runtime does not
> recognize your @OnMessage annotated method as a text message handler, which
> might happen for various reasons. One question maybe - does your Decoder
> implement interface " Decoder.Text", similalry as AuctionMessageDecoder? [1]
>
> Regards,
> Pavel
>
> [1]
> https://github.com/tyrus-project/tyrus/blob/master/samples/auction/src/main/java/org/glassfish/tyrus/sample/auction/decoders/AuctionMessageDecoder.java
>
>
>
> On 27/07/16 23:18, Chuck Davis wrote:
>>
>> I'm toying with websockets for Java clients (i.e. NOT browser based).
>> I have had success sending and receiving String objects. That,
>> however, is not too useful so I have been attempting to exchange a
>> developer object. Whenever I send it to the server endpoint the
>> container throws an exception which includes: "Text message handler
>> not found." If I include a String @OnMessage handler that is all that
>> ever gets called. Additionally, the exception message includes the
>> following: "decoders=[CoderWrapper{coderClass=class
>> com.yakridge.server.DOVariablesDecoder, coder=null, type=class
>> com.yakridge.common.DOVariables}" which seems to indicate the defined
>> decoder for my object is not being instantiated by the container ??
>>
>> Does anyone have a link to a complete example that has an annotated
>> ServerEndPoint and ClientEndPoint for a developer designed object --
>> something more than merely a String or text?
>>
>> Thanks for any direction.
>
>