So far, we can see all of the conversations, view individual messages in a conversation, and send new messages. What we can't do yet is get updates when new messages arrive on the device, so let's implement that now, starting with the server piece this time.
To get a constant stream of events, we'll use a feature called Server-Sent Events, a W3C specification for receiving push notifications from the server. We enabled this feature in Jersey by registering the SseFeature in both the client and server setup steps. To create an SSE endpoint, we specify that the method returns the media type SERVER_SENT_EVENTS, and we return an EventOutput as the payload:
@GET @Path("status") @Produces(SseFeature.SERVER_SENT_EVENTS) @Secure ...