Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2695

Unexpected/invalid sse event when mediaType is defined

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.5.8.Final
    • 4.5.6.Final
    • jaxrs
    • None
    • Undefined

      When mediaType is derived from @SseElementType or setting with EventBuilder's mediaType:

       
       

         @GET
         @Path("/bigmsg")
         @Produces(MediaType.SERVER_SENT_EVENTS)
         @SseElementType(MediaType.APPLICATION_JSON)
         public void bigEventMsg(@Context SseEventSink sink)     }

       
       

      eventSink.send(sse.newEventBuilder().mediaType(MediaType.APPLICATION_JSON_TYPE).data(jsonMessage).build());

      This sse message is sending like :
       

      -----------------Invalid ----------------------
      : this is comment
      id: id
      data: {
        "index": "Resteasy_Index_1",
      
        "message": "",    "foo": "bar" } 
      ---------------------------------------------------

      From Server sent events spec]] , the data value of this event will be interpreted as only unexpected value "{" . Others are all treated with other name fields or ignored.The intended json message are completely broken during processing.
       
       

       

       
       

              rhn-engineering-ema Jim Ma
              rhn-engineering-ema Jim Ma
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: