{ "info": { "author": "Openlabs Technologies & Consulting (P) LTD", "author_email": "info@openlabs.co.in", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Plugins", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Office/Business" ], "description": "Browser based Chat 1.0\n======================\n\nThis document describes the protocol behind the chat system used by\nnereid. We looked around for a possible standard based on which we could\nwrite a chat application which works within the browser. The search was\nfutile and this is an attempt to write a generic implementation inspired\nby XMPP to address browser based chat.\n\n1. Introduction\n---------------\n\n1.1 Overview\n~~~~~~~~~~~~\n\nThis protocol is a protocol fr streaming JSON in order to exchange messages\nand presence information in close to realtime.\n\n1.2 Requirements\n~~~~~~~~~~~~~~~~\n\n1. Compatible with most browsers.\n2. Compatible with proxies\n3. Fully compatible with HTTP/1.0.\n4. Fault Tolerant\n5. Extensible\n6. MUC rooms\n\n2. Concepts\n-----------\n\n\n2.1 Authentication\n~~~~~~~~~~~~~~~~~~\n\nThis protocol does not define any authentication mechanism of its own, but\nleaves it to the underlying HTTP layer. \n\n2.2 Thread \n~~~~~~~~~~\n\nThread an identifier that is used for tracking a conversation thread\n(sometimes referred to as an \"instant messaging session\") between two \nentities.\n\nEvery conversation in the system, to an individual user or to a group of\nusers (MUC) happens in a thread. When a new message is initiated to an\nindividual or a group of users, a thread is created if one does not\nalready exist with the given users. The thread id need not be human\nreadable. \n\n3. Syntax of Stanzas\n--------------------\n\nThe basic semantics and common attributes of JSON objects specific to the\nimplementation are outlined below. \n\nExample of a complete stanza\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: js\n\n {\n \"timestamp\": \"2011-02-10T15:04:55Z\",\n \"stanzas\": [\n {\n \"type\": \"message\"\n \"message\": {\n \"subject\": \"Optional topic of conversation\",\n \"text\": \"The message body\"\n \"type\": \"plain\",\n \"language\": \"en_US\",\n \"attachments\": [\n ],\n \"id\": \"\",\n \"thread\": \"thread-id\",\n \"sender\": {\n \"url\": \"http://example.org/martin\",\n \"objectType\": \"person\",\n \"id\": \"tag:example.org,2011:martin\",\n \"foo2\": \"some other extension property\",\n \"image\": {\n \"url\": \"http://example.org/martin/image\",\n \"width\": 250,\n \"height\": 250\n },\n \"displayName\": \"Martin Smith\"\n },\n },\n },\n {\n \"type\": \"presence\"\n \"presence\": [\n {\n \"entity\": \"nereid.user,123\",\n \"show\": \"chat\",\n \"status\": \"A happy day\",\n \"available\": true,\n }, {\n \"entity\": \"nereid.user,13\",\n \"show\": \"dnd\",\n \"status\": \"Busy in a meeting\",\n \"available\": true,\n }\n ],\n }\n ]\n\n\n\n3.1 Message\n~~~~~~~~~~~\n\nMessage stanzas are used to push information to another entity. Messages\nsent in the context of a chat conversation are sent in a message stanza to\nthe recipients.\n\n3.1.1 Subject\n.............\n\nThe `subject` attribute contains human-readable data that specifies the topic\nof the message. The attribute is optional\n\n3.1.2 Text\n...........\n\nThe `text` attribute contains human-readable data that specifies the\ntextual contents of the message; this attribute is normally included \nbut is OPTIONAL.\n\n3.1.3 Type \n...........\n\nThe `type` attribute contains the Content-Type minor for the textual\ncontents of the message. The attribute is OPTIONAL and the default value\nof the type is assumed to be `plain`. Possible values are:\n\n* `plain`\n* `html`\n* `rst`\n\n3.1.4 Language\n..............\n\nThe `language` attribute is used to help identify the human language in\nwhich the textual contents of the message are composed. The language is\nspecified in accordance with the IETF best practice, specified by `RFC\n5646` and `RFC 4647` for easy parsing by a computer. An example of\nlanguage is `en-US` (English as used in the United States (US is the \nISO 3166\u20111 country code for the United States)\n\n3.1.5 Attachments\n.................\n\nTODO\n\n3.1.6 ID\n........\n\nThis is meant to be a RFC 4122 compliant GUID for the message generated on\nthe client side. An UUID v4 generated should be sufficient. \n\n3.1.7 Thread\n............\n\nThe thread attribute contains non-human-readable character data specifying an\nidentifier that is used for tracking a conversation thread (sometimes referred\nto as an \"instant messaging session\") between two entities. The value of the \nthread attribute is generated by the sender and SHOULD be copied back in any \nreplies. \n\nIf left empty, the server implementation could decide if the message is a\ncontinuation of an existing conversation or a new conversation could be\ncreated for the purpose.\n\nIf used, it MUST be unique to that conversation thread within the stream and \nMUST be consistent throughout that conversation (a client that receives a \nmessage from the same sender but with a different thread ID MUST assume that \nthe message in question exists outside the context of the existing conversation \nthread).\n\n3.1.8 Sender\n............\n\nInspired from the actor in activity stream specification.\n\nTODO: Elaborate in detail\n\n\n3.1.9 Example Message\n.....................\n\n.. code:: js\n\n {\n \"timestamp\": \"2011-02-10T15:04:55Z\",\n \"type\": \"message\"\n \"message\": {\n \"subject\": \"Optional topic of conversation\",\n \"text\": \"The message body\"\n \"type\": \"plain\",\n \"language\": \"en_US\",\n \"attachments\": [\n ],\n \"id\": \"\",\n \"thread\": \"thread-id\",\n \"sender\": {\n \"url\": \"http://example.org/martin\",\n \"objectType\": \"person\",\n \"id\": \"tag:example.org,2011:martin\",\n \"foo2\": \"some other extension property\",\n \"image\": {\n \"url\": \"http://example.org/martin/image\",\n \"width\": 250,\n \"height\": 250\n },\n \"displayName\": \"Martin Smith\"\n },\n },\n }\n\n3.2 Presence\n~~~~~~~~~~~~\n\nPresence stanzas are used to express an entity's current network availability\n(offline or online, along with various sub-states of the latter and optional\nuser-defined descriptive text), and to notify other entities of that \navailability. Unlike XMPP Presence stanzas are **not** used to negotiate \nand manage subscriptions to the presence of other entities. Web\napplications are assumed to have their own unique ways of handling\nsubscriptions.\n\n3.2.1 Available\n...............\n\nA boolean value to indicate if the user is available for communication.\n\n\n3.2.2 Show\n..........\n\nThe OPTIONAL attribute contains non-human-readable character data that \nspecifies the particular availability status of an entity or specific \nresource.\n\n* away -- The entity or resource is temporarily away.\n* chat -- The entity or resource is actively interested in chatting.\n* dnd -- The entity or resource is busy (dnd = \"Do Not Disturb\").\n* xa -- The entity or resource is away for an extended period \n (xa = \"eXtended Away\").\n\n3.2.3 Status\n............\n\nThe OPTIONAL status element contains character data specifying a \nnatural-language description of availability status. It is normally \nused in conjunction with the show element to provide a detailed \ndescription of an availability state (e.g., \"In a meeting\").\n\n3.2.4 Entity \n............\n\nThe unique identifier of the entity of which the presence stanza has\ninformation about. \n\n3.2.5 Example Presence\n.....................\n\n.. code:: js\n\n {\n \"type\": \"presence\"\n \"presence\": [\n {\n \"entity\": \"nereid.user,123\",\n \"show\": \"chat\",\n \"status\": \"A happy day\",\n \"available\": true,\n }, {\n \"entity\": \"nereid.user,13\",\n \"show\": \"dnd\",\n \"status\": \"Busy in a meeting\",\n \"available\": true,\n }\n ],\n }\n\n4. Chat Token\n-------------\n\n4.1 Overview\n~~~~~~~~~~~~\n\nAuthorized token to fetch chat stream without nereid cookies based login.\n\n4.2 Usage with Session-less tokens\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nQuiet often chat is a part of a larger application and given the new\ntrends of single page applications, you may want to use the chat\nfunctionality without sessions. To implement the same this module\nprovides an API where an access token is initially generated by a\nlogged in user which can then be used exclusively to subscribe to\nchat messages, notifications and send new messages.\n\nThis token cannot be used for any other requests.\n\n.. note::\n\n\n For scalability reasons the chat tokens are stored in redis\n with TTL of 1 hour.\n\n\n4.2.1 Generate chat token\n.........................\n\nChat token can be generated by sending a POST request to the following\nURL.\n\n.. code::\n\n POST /nereid-chat/token\n\n\nResponse:\n\n.. code::\n\n HTTP/1.1 200 OK\n\n {'token': '550e8400-e29b-41d4-a716-446655440000'}\n\n\n4.2.2 Subscribing to stream using token\n........................................\n\nOnce a token is received with the above mentioned method call,\nit can then be used to subscribe to the event stream using the\nspecial handler shown below. Unlike the regular stream handler,\nthis one expects a token.\n\n.. code::\n\n GET /nereid-chat/stream/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.openlabs.co.in/", "keywords": null, "license": "GPL-3", "maintainer": null, "maintainer_email": null, "name": "openlabs_nereid_chat", "package_url": "https://pypi.org/project/openlabs_nereid_chat/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/openlabs_nereid_chat/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://www.openlabs.co.in/" }, "release_url": "https://pypi.org/project/openlabs_nereid_chat/3.0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Nereid Chat module", "version": "3.0.1.1" }, "last_serial": 1129213, "releases": { "3.0.0.1dev": [], "3.0.1.1": [ { "comment_text": "", "digests": { "md5": "5015875ad4fea34020ac83c73320bde6", "sha256": "d2d68950e64704d82a3821d0749c1717ad1af613300878f7e28fb52c6bc30780" }, "downloads": -1, "filename": "openlabs_nereid_chat-3.0.1.1.tar.gz", "has_sig": false, "md5_digest": "5015875ad4fea34020ac83c73320bde6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14338, "upload_time": "2014-06-18T15:40:21", "url": "https://files.pythonhosted.org/packages/0a/ea/2bda917dd3bd55b0971f828f082a0f22a801a39a2ddccee6e54867a47af3/openlabs_nereid_chat-3.0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5015875ad4fea34020ac83c73320bde6", "sha256": "d2d68950e64704d82a3821d0749c1717ad1af613300878f7e28fb52c6bc30780" }, "downloads": -1, "filename": "openlabs_nereid_chat-3.0.1.1.tar.gz", "has_sig": false, "md5_digest": "5015875ad4fea34020ac83c73320bde6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14338, "upload_time": "2014-06-18T15:40:21", "url": "https://files.pythonhosted.org/packages/0a/ea/2bda917dd3bd55b0971f828f082a0f22a801a39a2ddccee6e54867a47af3/openlabs_nereid_chat-3.0.1.1.tar.gz" } ] }