Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
jmazzitelli committed Jul 14, 2015
1 parent c0a53c3 commit ed2bc2f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modules/feed-comm/feed-comm-api/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@ If your client is Java, you can use the Java API that also comes with the artifa

Because this API flows over WebSockets, multiple requests and responses may be sent and received to clients. Because of this, in order to make it easier on the client to deserialize incoming requests and responses, the messages that flow over the WebSocket connection are not merely the JSON-encoded data. Instead, the JSON-encoded data is prefixed with the name of the schema, optionally prefixed with the package name. For example, suppose NotificationMessage schema results in a JSON of the form:

{noformat}{"message": "the msg here"}{noformat}
----
{"message":"the msg here"}
----

The client receiving this message will actually receive the following data:

{noformat}NotificationMessage={"message": "the msg here"}{noformat}
----
NotificationMessage={"message":"the msg here"}
----

It may optionally look like:

{noformat}org.hawkular.feedcomm.api.NotificationMessage={"message": "the msg here"}{noformat}
----
org.hawkular.feedcomm.api.NotificationMessage={"message":"the msg here"}
----

A Java client can use the utility org.hawkular.feedcomm.api.ApiDeserializer.deserialize() (passing in that string) to obtain the Java POJO that represents this notification message. A non-Java client can utilize the NotificationMessage.schema.json (note, the name of the schema is the same name as that prefix, minus any optional package name) in order to know how to deserialize the JSON message.

0 comments on commit ed2bc2f

Please sign in to comment.