{"action":"created","comment":{"url":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/comments/228563593","pull_request_review_id":168870101,"id":228563593,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyODU2MzU5Mw==","diff_hunk":"@@ -0,0 +1,69 @@\n+.. _websocket-clients:\n+\n+Clients\n+=======\n+\n+.. currentmodule:: trio_websocket\n+\n+Creating A Client\n+-----------------\n+\n+This page goes into the details of creating a WebSocket client. Let's start by\n+revisiting the example from the :ref:`client-tutorial`.\n+\n+.. code-block:: python\n+    :linenos:\n+\n+    import trio\n+    from trio_websocket import open_websocket_url\n+\n+\n+    async def main():\n+        try:\n+            async with open_websocket_url('wss://localhost/foo') as ws:\n+                await ws.send_message('hello world!')\n+                message = await ws.get_message()\n+                logging.info('Received message: %s', message)\n+        except OSError as ose:\n+            logging.error('Connection attempt failed: %s', ose)\n+\n+    trio.run(main)\n+\n+.. note::\n+\n+    A more complete example is included `in the repository\n+    <https://github.com/HyperionGray/trio-websocket/blob/master/examples/client.py>`__.\n+\n+As explained in the tutorial, ``open_websocket_url(…)`` is a context manager\n+that ensures the connection is properly opened and ready before entering the\n+block. It also ensures that the connection is closed before exiting the block.\n+This library contains two such context managers for creating client connections:\n+one to connect by host and one to connect by URL.\n+\n+.. autofunction:: open_websocket\n+    :async-with: ws\n+\n+.. autofunction:: open_websocket_url\n+    :async-with: ws\n+\n+Custom Nursery\n+--------------\n+\n+The two context managers above create an internal nursery to run background\n+tasks. If you wish to specify your own nursery instead, you should use the\n+the following convenience functions instead.\n+\n+.. autofunction:: connect_websocket\n+.. autofunction:: connect_websocket_url\n+\n+Custom Stream\n+-------------\n+\n+The WebSocket protocol is defined as an application layer protocol that runs on\n+top of TCP, and the convenience functions described above automatically create\n+those TCP connections. In more obscure use cases, you might want to run the\n+WebSocket protocol on top of some other type of transport protocol. The library\n+includes a convenience function that allows you to wrap any arbitrary Trio\n+stream with a client WebSocket.\n+\n+.. autofunction:: wrap_client_stream","path":"docs/clients.rst","position":69,"original_position":69,"commit_id":"22d785dda8bcc57a318069329cdd4cfc0aea9897","original_commit_id":"22d785dda8bcc57a318069329cdd4cfc0aea9897","user":{"login":"mehaase","id":320904,"node_id":"MDQ6VXNlcjMyMDkwNA==","avatar_url":"https://avatars1.githubusercontent.com/u/320904?v=4","gravatar_id":"","url":"https://api.github.com/users/mehaase","html_url":"https://github.com/mehaase","followers_url":"https://api.github.com/users/mehaase/followers","following_url":"https://api.github.com/users/mehaase/following{/other_user}","gists_url":"https://api.github.com/users/mehaase/gists{/gist_id}","starred_url":"https://api.github.com/users/mehaase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mehaase/subscriptions","organizations_url":"https://api.github.com/users/mehaase/orgs","repos_url":"https://api.github.com/users/mehaase/repos","events_url":"https://api.github.com/users/mehaase/events{/privacy}","received_events_url":"https://api.github.com/users/mehaase/received_events","type":"User","site_admin":false},"body":"It does have a nursery argument. (The arguments are added by `autofunction`.) ","created_at":"2018-10-26T15:09:30Z","updated_at":"2018-10-26T15:09:30Z","html_url":"https://github.com/HyperionGray/trio-websocket/pull/71#discussion_r228563593","pull_request_url":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/71","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/comments/228563593"},"html":{"href":"https://github.com/HyperionGray/trio-websocket/pull/71#discussion_r228563593"},"pull_request":{"href":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/71"}},"in_reply_to_id":228438257},"pull_request":{"url":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/71","id":225811549,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI1ODExNTQ5","html_url":"https://github.com/HyperionGray/trio-websocket/pull/71","diff_url":"https://github.com/HyperionGray/trio-websocket/pull/71.diff","patch_url":"https://github.com/HyperionGray/trio-websocket/pull/71.patch","issue_url":"https://api.github.com/repos/HyperionGray/trio-websocket/issues/71","number":71,"state":"open","locked":false,"title":"Create docs","user":{"login":"mehaase","id":320904,"node_id":"MDQ6VXNlcjMyMDkwNA==","avatar_url":"https://avatars1.githubusercontent.com/u/320904?v=4","gravatar_id":"","url":"https://api.github.com/users/mehaase","html_url":"https://github.com/mehaase","followers_url":"https://api.github.com/users/mehaase/followers","following_url":"https://api.github.com/users/mehaase/following{/other_user}","gists_url":"https://api.github.com/users/mehaase/gists{/gist_id}","starred_url":"https://api.github.com/users/mehaase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mehaase/subscriptions","organizations_url":"https://api.github.com/users/mehaase/orgs","repos_url":"https://api.github.com/users/mehaase/repos","events_url":"https://api.github.com/users/mehaase/events{/privacy}","received_events_url":"https://api.github.com/users/mehaase/received_events","type":"User","site_admin":false},"body":"This PR includes documentation in Sphinx format, published to Read The Docs here: \r\n\r\nhttps://trio-websocket.readthedocs.io/\r\n\r\nThis should be pretty complete and I've proofread for grammar issues, broken links, etc. It could use a quick review for clarity and omissions.","created_at":"2018-10-25T15:45:56Z","updated_at":"2018-10-26T15:09:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3604a17aa22168623b31389ea520fd883fa4448f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/71/commits","review_comments_url":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/71/comments","review_comment_url":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HyperionGray/trio-websocket/issues/71/comments","statuses_url":"https://api.github.com/repos/HyperionGray/trio-websocket/statuses/22d785dda8bcc57a318069329cdd4cfc0aea9897","head":{"label":"HyperionGray:create_docs","ref":"create_docs","sha":"22d785dda8bcc57a318069329cdd4cfc0aea9897","user":{"login":"HyperionGray","id":11542868,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTQyODY4","avatar_url":"https://avatars1.githubusercontent.com/u/11542868?v=4","gravatar_id":"","url":"https://api.github.com/users/HyperionGray","html_url":"https://github.com/HyperionGray","followers_url":"https://api.github.com/users/HyperionGray/followers","following_url":"https://api.github.com/users/HyperionGray/following{/other_user}","gists_url":"https://api.github.com/users/HyperionGray/gists{/gist_id}","starred_url":"https://api.github.com/users/HyperionGray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HyperionGray/subscriptions","organizations_url":"https://api.github.com/users/HyperionGray/orgs","repos_url":"https://api.github.com/users/HyperionGray/repos","events_url":"https://api.github.com/users/HyperionGray/events{/privacy}","received_events_url":"https://api.github.com/users/HyperionGray/received_events","type":"Organization","site_admin":false},"repo":{"id":146345539,"node_id":"MDEwOlJlcG9zaXRvcnkxNDYzNDU1Mzk=","name":"trio-websocket","full_name":"HyperionGray/trio-websocket","private":false,"owner":{"login":"HyperionGray","id":11542868,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTQyODY4","avatar_url":"https://avatars1.githubusercontent.com/u/11542868?v=4","gravatar_id":"","url":"https://api.github.com/users/HyperionGray","html_url":"https://github.com/HyperionGray","followers_url":"https://api.github.com/users/HyperionGray/followers","following_url":"https://api.github.com/users/HyperionGray/following{/other_user}","gists_url":"https://api.github.com/users/HyperionGray/gists{/gist_id}","starred_url":"https://api.github.com/users/HyperionGray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HyperionGray/subscriptions","organizations_url":"https://api.github.com/users/HyperionGray/orgs","repos_url":"https://api.github.com/users/HyperionGray/repos","events_url":"https://api.github.com/users/HyperionGray/events{/privacy}","received_events_url":"https://api.github.com/users/HyperionGray/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/HyperionGray/trio-websocket","description":"WebSocket implementation for Python Trio","fork":false,"url":"https://api.github.com/repos/HyperionGray/trio-websocket","forks_url":"https://api.github.com/repos/HyperionGray/trio-websocket/forks","keys_url":"https://api.github.com/repos/HyperionGray/trio-websocket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HyperionGray/trio-websocket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HyperionGray/trio-websocket/teams","hooks_url":"https://api.github.com/repos/HyperionGray/trio-websocket/hooks","issue_events_url":"https://api.github.com/repos/HyperionGray/trio-websocket/issues/events{/number}","events_url":"https://api.github.com/repos/HyperionGray/trio-websocket/events","assignees_url":"https://api.github.com/repos/HyperionGray/trio-websocket/assignees{/user}","branches_url":"https://api.github.com/repos/HyperionGray/trio-websocket/branches{/branch}","tags_url":"https://api.github.com/repos/HyperionGray/trio-websocket/tags","blobs_url":"https://api.github.com/repos/HyperionGray/trio-websocket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HyperionGray/trio-websocket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HyperionGray/trio-websocket/git/refs{/sha}","trees_url":"https://api.github.com/repos/HyperionGray/trio-websocket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HyperionGray/trio-websocket/statuses/{sha}","languages_url":"https://api.github.com/repos/HyperionGray/trio-websocket/languages","stargazers_url":"https://api.github.com/repos/HyperionGray/trio-websocket/stargazers","contributors_url":"https://api.github.com/repos/HyperionGray/trio-websocket/contributors","subscribers_url":"https://api.github.com/repos/HyperionGray/trio-websocket/subscribers","subscription_url":"https://api.github.com/repos/HyperionGray/trio-websocket/subscription","commits_url":"https://api.github.com/repos/HyperionGray/trio-websocket/commits{/sha}","git_commits_url":"https://api.github.com/repos/HyperionGray/trio-websocket/git/commits{/sha}","comments_url":"https://api.github.com/repos/HyperionGray/trio-websocket/comments{/number}","issue_comment_url":"https://api.github.com/repos/HyperionGray/trio-websocket/issues/comments{/number}","contents_url":"https://api.github.com/repos/HyperionGray/trio-websocket/contents/{+path}","compare_url":"https://api.github.com/repos/HyperionGray/trio-websocket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HyperionGray/trio-websocket/merges","archive_url":"https://api.github.com/repos/HyperionGray/trio-websocket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HyperionGray/trio-websocket/downloads","issues_url":"https://api.github.com/repos/HyperionGray/trio-websocket/issues{/number}","pulls_url":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls{/number}","milestones_url":"https://api.github.com/repos/HyperionGray/trio-websocket/milestones{/number}","notifications_url":"https://api.github.com/repos/HyperionGray/trio-websocket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HyperionGray/trio-websocket/labels{/name}","releases_url":"https://api.github.com/repos/HyperionGray/trio-websocket/releases{/id}","deployments_url":"https://api.github.com/repos/HyperionGray/trio-websocket/deployments","created_at":"2018-08-27T19:42:15Z","updated_at":"2018-10-24T13:52:39Z","pushed_at":"2018-10-25T15:50:36Z","git_url":"git://github.com/HyperionGray/trio-websocket.git","ssh_url":"git@github.com:HyperionGray/trio-websocket.git","clone_url":"https://github.com/HyperionGray/trio-websocket.git","svn_url":"https://github.com/HyperionGray/trio-websocket","homepage":null,"size":153,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2,"open_issues":16,"watchers":6,"default_branch":"master"}},"base":{"label":"HyperionGray:master","ref":"master","sha":"8d6d35597e12369b2b7cf5ceadb8c9c95df9e9f3","user":{"login":"HyperionGray","id":11542868,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTQyODY4","avatar_url":"https://avatars1.githubusercontent.com/u/11542868?v=4","gravatar_id":"","url":"https://api.github.com/users/HyperionGray","html_url":"https://github.com/HyperionGray","followers_url":"https://api.github.com/users/HyperionGray/followers","following_url":"https://api.github.com/users/HyperionGray/following{/other_user}","gists_url":"https://api.github.com/users/HyperionGray/gists{/gist_id}","starred_url":"https://api.github.com/users/HyperionGray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HyperionGray/subscriptions","organizations_url":"https://api.github.com/users/HyperionGray/orgs","repos_url":"https://api.github.com/users/HyperionGray/repos","events_url":"https://api.github.com/users/HyperionGray/events{/privacy}","received_events_url":"https://api.github.com/users/HyperionGray/received_events","type":"Organization","site_admin":false},"repo":{"id":146345539,"node_id":"MDEwOlJlcG9zaXRvcnkxNDYzNDU1Mzk=","name":"trio-websocket","full_name":"HyperionGray/trio-websocket","private":false,"owner":{"login":"HyperionGray","id":11542868,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTQyODY4","avatar_url":"https://avatars1.githubusercontent.com/u/11542868?v=4","gravatar_id":"","url":"https://api.github.com/users/HyperionGray","html_url":"https://github.com/HyperionGray","followers_url":"https://api.github.com/users/HyperionGray/followers","following_url":"https://api.github.com/users/HyperionGray/following{/other_user}","gists_url":"https://api.github.com/users/HyperionGray/gists{/gist_id}","starred_url":"https://api.github.com/users/HyperionGray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HyperionGray/subscriptions","organizations_url":"https://api.github.com/users/HyperionGray/orgs","repos_url":"https://api.github.com/users/HyperionGray/repos","events_url":"https://api.github.com/users/HyperionGray/events{/privacy}","received_events_url":"https://api.github.com/users/HyperionGray/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/HyperionGray/trio-websocket","description":"WebSocket implementation for Python Trio","fork":false,"url":"https://api.github.com/repos/HyperionGray/trio-websocket","forks_url":"https://api.github.com/repos/HyperionGray/trio-websocket/forks","keys_url":"https://api.github.com/repos/HyperionGray/trio-websocket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HyperionGray/trio-websocket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HyperionGray/trio-websocket/teams","hooks_url":"https://api.github.com/repos/HyperionGray/trio-websocket/hooks","issue_events_url":"https://api.github.com/repos/HyperionGray/trio-websocket/issues/events{/number}","events_url":"https://api.github.com/repos/HyperionGray/trio-websocket/events","assignees_url":"https://api.github.com/repos/HyperionGray/trio-websocket/assignees{/user}","branches_url":"https://api.github.com/repos/HyperionGray/trio-websocket/branches{/branch}","tags_url":"https://api.github.com/repos/HyperionGray/trio-websocket/tags","blobs_url":"https://api.github.com/repos/HyperionGray/trio-websocket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HyperionGray/trio-websocket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HyperionGray/trio-websocket/git/refs{/sha}","trees_url":"https://api.github.com/repos/HyperionGray/trio-websocket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HyperionGray/trio-websocket/statuses/{sha}","languages_url":"https://api.github.com/repos/HyperionGray/trio-websocket/languages","stargazers_url":"https://api.github.com/repos/HyperionGray/trio-websocket/stargazers","contributors_url":"https://api.github.com/repos/HyperionGray/trio-websocket/contributors","subscribers_url":"https://api.github.com/repos/HyperionGray/trio-websocket/subscribers","subscription_url":"https://api.github.com/repos/HyperionGray/trio-websocket/subscription","commits_url":"https://api.github.com/repos/HyperionGray/trio-websocket/commits{/sha}","git_commits_url":"https://api.github.com/repos/HyperionGray/trio-websocket/git/commits{/sha}","comments_url":"https://api.github.com/repos/HyperionGray/trio-websocket/comments{/number}","issue_comment_url":"https://api.github.com/repos/HyperionGray/trio-websocket/issues/comments{/number}","contents_url":"https://api.github.com/repos/HyperionGray/trio-websocket/contents/{+path}","compare_url":"https://api.github.com/repos/HyperionGray/trio-websocket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HyperionGray/trio-websocket/merges","archive_url":"https://api.github.com/repos/HyperionGray/trio-websocket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HyperionGray/trio-websocket/downloads","issues_url":"https://api.github.com/repos/HyperionGray/trio-websocket/issues{/number}","pulls_url":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls{/number}","milestones_url":"https://api.github.com/repos/HyperionGray/trio-websocket/milestones{/number}","notifications_url":"https://api.github.com/repos/HyperionGray/trio-websocket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HyperionGray/trio-websocket/labels{/name}","releases_url":"https://api.github.com/repos/HyperionGray/trio-websocket/releases{/id}","deployments_url":"https://api.github.com/repos/HyperionGray/trio-websocket/deployments","created_at":"2018-08-27T19:42:15Z","updated_at":"2018-10-24T13:52:39Z","pushed_at":"2018-10-25T15:50:36Z","git_url":"git://github.com/HyperionGray/trio-websocket.git","ssh_url":"git@github.com:HyperionGray/trio-websocket.git","clone_url":"https://github.com/HyperionGray/trio-websocket.git","svn_url":"https://github.com/HyperionGray/trio-websocket","homepage":null,"size":153,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":16,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":2,"open_issues":16,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/71"},"html":{"href":"https://github.com/HyperionGray/trio-websocket/pull/71"},"issue":{"href":"https://api.github.com/repos/HyperionGray/trio-websocket/issues/71"},"comments":{"href":"https://api.github.com/repos/HyperionGray/trio-websocket/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HyperionGray/trio-websocket/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/HyperionGray/trio-websocket/statuses/22d785dda8bcc57a318069329cdd4cfc0aea9897"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"mehaase"}}