Resin Documentationapp server |
jamp (json actor message protocol)The following drafts are available for JSON Actor Message Protocol (most recent first). draft-ferg-jamp-v0 [txt | html] JAMP adds a small amount of standard structure to JSON messaging. It's intended to be usable for multiple transports, including WebSockets, HTTP REST, and messaging like STOMP. JAMP is a JSON message payload with additional
As a motivational example, a server might support a tic-tac-toe game. Each client would join a game, send moves, and receive game updates from the server. A possible message might be a player move to place an "X" at location 4 in the game. The specific game instance id might be "jamp+ws://example.com/tictactoe/game73". The player's login might be "jamp+ws://example.com/user32/ipad13". ["send", "jamp+ws://example.com/tictactoe/game73", "jamp+ws://example.com/user13/ipad13", "move", [ "4", "X"]] A possible query (RPC) might be a player joining a new game. In this query, the user asks the game-manager to join the game. The query "to" address is the game-manager. The "from" is the player's login. The action is "join_game". The query has a query-id 13 to match up queries and responses. JAMP allows any ordering or interleaving of messages, queries, and responses as long as the query eventually returns a reply (or error_query). ["query", 13, "jamp+ws://example.com/game-manager", "jamp+ws://example.com/user13/ipad39", "join_game" [ "tictactoe" ]] The response has a matching query-id of 13, and the "to" and "from" addresses are swapped for the reply. ["reply", 13, "jamp+ws://example.com/user13/ipad39", "jamp+ws://example.com/game-manager", {"game": "tictactoe", "address": "jamp+ws://example.com/tictactoe/game89", "side": "X"}] Because JAMP is designed as an application protocol, you can use only those parts you need from JAMP. For example, an application might only need unidirectional messages. Or might only need query-response. For example, if an application needs object-oriented messages, but not addresses or queries, it can just send null values for the addresses. ["send", null, null, "move", ["4", "X"]]
|