{"action":"created","issue":{"url":"https://api.github.com/repos/boostorg/beast/issues/1117","repository_url":"https://api.github.com/repos/boostorg/beast","labels_url":"https://api.github.com/repos/boostorg/beast/issues/1117/labels{/name}","comments_url":"https://api.github.com/repos/boostorg/beast/issues/1117/comments","events_url":"https://api.github.com/repos/boostorg/beast/issues/1117/events","html_url":"https://github.com/boostorg/beast/issues/1117","id":320598431,"number":1117,"title":"Canceling websocket async operations and status of websocket connection","user":{"login":"shuras109","id":23736445,"avatar_url":"https://avatars0.githubusercontent.com/u/23736445?v=4","gravatar_id":"","url":"https://api.github.com/users/shuras109","html_url":"https://github.com/shuras109","followers_url":"https://api.github.com/users/shuras109/followers","following_url":"https://api.github.com/users/shuras109/following{/other_user}","gists_url":"https://api.github.com/users/shuras109/gists{/gist_id}","starred_url":"https://api.github.com/users/shuras109/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shuras109/subscriptions","organizations_url":"https://api.github.com/users/shuras109/orgs","repos_url":"https://api.github.com/users/shuras109/repos","events_url":"https://api.github.com/users/shuras109/events{/privacy}","received_events_url":"https://api.github.com/users/shuras109/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-06T14:42:00Z","updated_at":"2018-05-06T16:46:02Z","closed_at":"2018-05-06T16:27:43Z","author_association":"NONE","body":" Is there any way to cancel async operations and be able to do async_close for websocket connection later?\r\n With current 1.67 boost beast I've tried to do something like that: \"ws_.next_layer().cancel();\". As soon as websocket  async_read finished with operation_aborted error websoket connection open status become \"false\" while open status of underlying socket is still \"true\". And if I try to do async_close later ws connection closed instantly without graceful websocket shutdown (reason wasn't send).\r\n  Is there anyway else to do it? I just want to drop all pending async operations and do some other operations before closing websocket connection. Currently I am coerce to keep pending async ops and just ignore them if some of them complete. \r\n"},"comment":{"url":"https://api.github.com/repos/boostorg/beast/issues/comments/386892624","html_url":"https://github.com/boostorg/beast/issues/1117#issuecomment-386892624","issue_url":"https://api.github.com/repos/boostorg/beast/issues/1117","id":386892624,"user":{"login":"vinniefalco","id":1503976,"avatar_url":"https://avatars3.githubusercontent.com/u/1503976?v=4","gravatar_id":"","url":"https://api.github.com/users/vinniefalco","html_url":"https://github.com/vinniefalco","followers_url":"https://api.github.com/users/vinniefalco/followers","following_url":"https://api.github.com/users/vinniefalco/following{/other_user}","gists_url":"https://api.github.com/users/vinniefalco/gists{/gist_id}","starred_url":"https://api.github.com/users/vinniefalco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinniefalco/subscriptions","organizations_url":"https://api.github.com/users/vinniefalco/orgs","repos_url":"https://api.github.com/users/vinniefalco/repos","events_url":"https://api.github.com/users/vinniefalco/events{/privacy}","received_events_url":"https://api.github.com/users/vinniefalco/received_events","type":"User","site_admin":false},"created_at":"2018-05-06T16:46:02Z","updated_at":"2018-05-06T16:46:02Z","author_association":"MEMBER","body":"If you have a pending call to `async_read`, and you call `async_close`, a close frame will be sent to the remote peer, and then one of two things will happen:\r\n\r\n1. If the `async_read` is in the middle of receiving a message frame, it will finish reading the message and invoke the completion handler. Then the `async_close` operation will read the close frame from the remote peer, and the connection will be closed. The completion handler for the `async_close` will be invoked\r\n\r\n2. If `async_read` has not received any bytes corresponding to a new message frame, it will read the close frame from the remote peer, and the error `websocket::error::closed` will be delivered to the completion handler. Then the connection will be closed.\r\n\r\nIn both cases, the connection is closed. Therefore, if you want to stop the websocket stream you should simply call `async_close`, possibly discarding any message data received in a subsequent invocation of the read completion handler.\r\n"}}
{"actor":{"display_login":"vinniefalco"}}