Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1249

Unable to decode Binary Messages if Text Decoder is set

    XMLWordPrintable

Details

    • Hide

      Create JSR WebSocket endpoint with both binary and text decoder for the same Type 'MyObject':

      @ServerEndpoint(
      		value = "/ws",
      		decoders = { MyObjectBinaryDecoder.class, MyObjectTextDecoder.class }
      )
      ...
      

      Send binary data to the endpoint; it can't decode.

      Show
      Create JSR WebSocket endpoint with both binary and text decoder for the same Type 'MyObject': @ServerEndpoint( value = "/ws" , decoders = { MyObjectBinaryDecoder.class, MyObjectTextDecoder.class } ) ... Send binary data to the endpoint; it can't decode.

    Description

      It seems if a Text decoder for a particular Type is set it cannot decode binary data for the same Type if encountered. This appears to be due to it assuming if one decoder is found then you'll never need another (see HandlerWrapper:396) and it checks for text first, binary never gets a chance.

      The JavaDoc does state:

      The websocket runtime will use the first decoder in the list able to decode a message, ignoring the remaining decoders.

      Although this does not explicitly state it should differentiate, 'able' implies that it should be able to differentiate between Text and Binary message types for the same Type.

      Although not tested, it appears this code has not been updated in the 'master' either, so should exhibit the same behaviour.

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            dansiviter Daniel Siviter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: