In GlassFish 4 or Tyrus (WebSocket 1.0 API), Decoder has willDecode method to determine whether this Decoder will decode.
But Encoder does not have willEncode method. How does WebSocket API determine encoders. Should Encoder have willEncode method?
In GlassFish 4 or Tyrus (WebSocket 1.0 API), Decoder has willDecode method to determine whether this Decoder will decode.
But Encoder does not have willEncode method. How does WebSocket API determine encoders. Should Encoder have willEncode method?
I got a answer from Arun Gupta.
He said that Decoder needs to peek into the message and decide. Encoder knows the POJO to encode.
Then I understand.
Endpoint cannot be registered two MessageHandler for text message or for binary message per one Endpoint, but can be registered each one MessageHandler for text message and binary message. Then Endpoint handles 2 types of POJO, so WebSocket implementation can decide Encoder by POJO type.
Thank you.