{"action":"created","issue":{"url":"https://api.github.com/repos/tatsuhiro-t/wslay/issues/22","labels_url":"https://api.github.com/repos/tatsuhiro-t/wslay/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/tatsuhiro-t/wslay/issues/22/comments","events_url":"https://api.github.com/repos/tatsuhiro-t/wslay/issues/22/events","html_url":"https://github.com/tatsuhiro-t/wslay/pull/22","id":93451418,"number":22,"title":"Allow to stop receiving message from on_msg_recv_callback","user":{"login":"wonder-mice","id":1161846,"avatar_url":"https://avatars.githubusercontent.com/u/1161846?v=3","gravatar_id":"","url":"https://api.github.com/users/wonder-mice","html_url":"https://github.com/wonder-mice","followers_url":"https://api.github.com/users/wonder-mice/followers","following_url":"https://api.github.com/users/wonder-mice/following{/other_user}","gists_url":"https://api.github.com/users/wonder-mice/gists{/gist_id}","starred_url":"https://api.github.com/users/wonder-mice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wonder-mice/subscriptions","organizations_url":"https://api.github.com/users/wonder-mice/orgs","repos_url":"https://api.github.com/users/wonder-mice/repos","events_url":"https://api.github.com/users/wonder-mice/events{/privacy}","received_events_url":"https://api.github.com/users/wonder-mice/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-07T06:35:22Z","updated_at":"2015-07-07T18:46:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tatsuhiro-t/wslay/pulls/22","html_url":"https://github.com/tatsuhiro-t/wslay/pull/22","diff_url":"https://github.com/tatsuhiro-t/wslay/pull/22.diff","patch_url":"https://github.com/tatsuhiro-t/wslay/pull/22.patch"},"body":"I need a way to tell wslay to stop calling on_msg_recv_callback (because my message queue is already full and I only can drop message if they will continue to come) and to return. When I decide that I'm ready to receive more messages, I will call wslay_event_recv() once again.\r\n\r\nDon't see any existing way to achieve that. Suggesting this patch to address this issue."},"comment":{"url":"https://api.github.com/repos/tatsuhiro-t/wslay/issues/comments/119299968","html_url":"https://github.com/tatsuhiro-t/wslay/pull/22#issuecomment-119299968","issue_url":"https://api.github.com/repos/tatsuhiro-t/wslay/issues/22","id":119299968,"user":{"login":"wonder-mice","id":1161846,"avatar_url":"https://avatars.githubusercontent.com/u/1161846?v=3","gravatar_id":"","url":"https://api.github.com/users/wonder-mice","html_url":"https://github.com/wonder-mice","followers_url":"https://api.github.com/users/wonder-mice/followers","following_url":"https://api.github.com/users/wonder-mice/following{/other_user}","gists_url":"https://api.github.com/users/wonder-mice/gists{/gist_id}","starred_url":"https://api.github.com/users/wonder-mice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wonder-mice/subscriptions","organizations_url":"https://api.github.com/users/wonder-mice/orgs","repos_url":"https://api.github.com/users/wonder-mice/repos","events_url":"https://api.github.com/users/wonder-mice/events{/privacy}","received_events_url":"https://api.github.com/users/wonder-mice/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T18:46:10Z","updated_at":"2015-07-07T18:46:10Z","body":"What do you think about that?\r\n\r\ndiff --git a/lib/wslay_event.c b/lib/wslay_event.c\r\nindex 5d11516..2454d5f 100644\r\n--- a/lib/wslay_event.c\r\n+++ b/lib/wslay_event.c\r\n@@ -716,7 +716,8 @@ int wslay_event_recv(wslay_event_context_ptr ctx)\r\n               arg.msg_length = msg_length;\r\n               arg.status_code = status_code;\r\n               ctx->error = 0;\r\n-              stop = ctx->callbacks.on_msg_recv_callback(ctx, &arg, ctx->user_data);\r\n+              ctx->callbacks.on_msg_recv_callback(ctx, &arg, ctx->user_data);\r\n+              stop = ctx->error;\r\n             }\r\n             free(msg);\r\n           }"}}