TOC |
|
The JSON Message Protocol defines a bidirectional messaging protocol using JSON as a payload serialization format. Messages are typed and addressed. Both unidirectional messages and bidirectional queries are supported. JSMP is expected to be built on top of a framing protocol like WebSockets.
By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as “work in progress.”
The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt.
The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html.
This Internet-Draft will expire on October 9, 2011.
1.
Introduction
2.
Requirements
3.
Protocol Overview
4.
General Requirements
4.1.
Requirements
4.2.
Syntax Notation
4.3.
Terminology
4.4.
Basic Rules
5.
Packets
5.1.
message
5.2.
message-error
5.3.
query
5.4.
response
5.5.
query-error
6.
Security Considerations
7.
Normative References
§
Author's Address
§
Intellectual Property and Copyright Statements
TOC |
The goal of JSMP is to provide structure for a JSON-based messaging over a WebSockets connection.
JSON supports:
TOC |
TOC |
This section is non-normative.
A unidirectional message looks as follows:
["message", "to@target.example.com", "from@source.example.com/sample", "com.example.MyMessageType", {"value", "my-payload-value"}]
Bidirectional queries consist of a "query" packet and a corresponding "response" packet. The query and response are correlated with a correlation-id, which is a 64-bit integer.
A service MUST response to a "query" with either a "response" or a "query_error" because the client will be waiting for the response.
A query looks as follows:
["query", "to@target.example.com", "from@source.example.com", 12345, "com.example.MyQueryType", {"value", "my-payload-value"}]
The corresponding response looks as follows:
["response", "from@source.example.com", "to@target.example.com", 12345, "com.example.MyResponseType", {"value", "my-payload-value"}]
TOC |
TOC |
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
An implementation is not compliant if it fails to satisfy one or more of the MUST or REQUIRED level requirements for the protocols it implements. An implementation that satisfies all the MUST or REQUIRED level and all the SHOULD level requirements for its protocols is said to be "unconditionally compliant"; one that satisfies all the MUST level requirements but not all the SHOULD level requirements for its protocols is said to be "conditionally compliant."
TOC |
This specification uses the Augmented Backus-Naur Form (ABNF) notation of [RFC5234] (Crocker, D. and P. Overell, “Augmented BNF for Syntax Specifications: ABNF,” January 2008.).
The following core rules are included by reference, as defined in [RFC5234] (Crocker, D. and P. Overell, “Augmented BNF for Syntax Specifications: ABNF,” January 2008.), Appendix B.1: ALPHA (letters), CR (carriage return), CRLF (CR LF), DIGIT (decimal 0-9), OCTET (any 8-bit sequence of data), SP (space), VCHAR (any visible [USASCII] character), and WSP (whitespace).
TOC |
This specification the following JSMP
address: An address of a JSMP actor/service.
payload: A JSON value.
type: A string representing a message type.
TOC |
The following basic rules follow the definitions in HTTP [RFC2616] (Fielding, R., Gettys, J., Mogul, J., Mainter, L., Leach, P., and T. Berners-Lee, “Hypertext Transfer Protocol -- HTTP/1.1,” June 1999.).
type = 1* ( ALPHA / DIGIT / "_" / "." ) query_id = 1* DIGIT payload = JSON error_payload = JSON address = [user '@'] domain [ '/' resource ] user = 1* (ALPHA / DIGIT / '_' / '.' / '-' / '+' / ':' ) domain = 1* (ALPHA / DIGIT / '_' / '.' / '-' / '+' / ':' ) resource = 1* (ALPHA / DIGIT / '_' / '.' / '-' / '+' / ':' )
TOC |
The following 5 packets are the only packets allowed for JSMP: message, message_error, query, response, query_error.
The stream consists of a sequence of packets.
stream = *( packet ) packet = message / message-error / query / response / query-error
TOC |
message is a unidirectional message.
query grammar
message ::= '[' "message" ',' address ',' address ',' type ',' payload ']'
A unidirectional message looks as follows:
["message", "to@target.example.com", "from@source.example.com", "com.example.MyMessageType", {"value", "my-payload-value"}]
TOC |
message is an error response to a message.
A unidirectional message looks as follows:
["message_error", "from@source.example.com", "to@target.example.com", "com.example.MyMessageType", {"value": "my-payload-value"} {"group": "internal-server-error", "text" : "my-error"}]
TOC |
query is a bidirectional request for a response. A receiver MUST response with either a "response" or a "queryError"
query grammar
query ::= '[' "query" ',' address ',' address ',' query_id ',' type ',' payload ']'
Example: A query looks as follows:
["query", "to@target.example.com", "from@source.example.com", 12345, "com.example.MyQueryType", {"value", "my-payload-value"}]
TOC |
"response" is a bidirectional response to a query.
response grammar
response ::= '[' "response" ',' address ',' address ',' query_id ',' type ',' payload ']'
Example: A response looks as follows:
["response", "to@target.example.com", "from@source.example.com", 12345, "com.example.MyQueryType", {"value", "my-payload-value"}]
TOC |
query-error is an error response to a message.
query-error grammar
query_error ::= '[' "query_error" ',' address ',' address ',' query_id ',' type ',' payload ',' error_payload ']'
A unidirectional message looks as follows:
["query_error", "from@source.example.com", "to@target.example.com", 12345, "com.example.MyMessageType", {"value", "my-payload-value"}, {"group", "internal-server-error"}]
TOC |
This section is meant to inform application developers and users of security issues related to JSMP. This list is unlikely to be complete.
TOC |
[RFC2616] | Fielding, R., Gettys, J., Mogul, J., Mainter, L., Leach, P., and T. Berners-Lee, “Hypertext Transfer Protocol -- HTTP/1.1,” RFC 2616, June 1999. |
[RFC3629] | Yergeau, F., “UTF-8, a transformation format of ISO 10646,” STD 63, RFC 3629, November 2003. |
[RFC5234] | Crocker, D. and P. Overell, “Augmented BNF for Syntax Specifications: ABNF,” STD 68, RFC 5234, January 2008. |
TOC |
Scott Ferguson | |
Caucho Technology |
TOC |
Copyright © The IETF Trust (2011).
This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.
This document and the information contained herein are provided on an “AS IS” basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org.