{"action":"created","issue":{"url":"https://api.github.com/repos/theturtle32/WebSocket-Node/issues/205","labels_url":"https://api.github.com/repos/theturtle32/WebSocket-Node/issues/205/labels{/name}","comments_url":"https://api.github.com/repos/theturtle32/WebSocket-Node/issues/205/comments","events_url":"https://api.github.com/repos/theturtle32/WebSocket-Node/issues/205/events","html_url":"https://github.com/theturtle32/WebSocket-Node/issues/205","id":95324998,"number":205,"title":"Inform user when peer fails to reply with pong() ","user":{"login":"bayofpigs","id":3136044,"avatar_url":"https://avatars.githubusercontent.com/u/3136044?v=3","gravatar_id":"","url":"https://api.github.com/users/bayofpigs","html_url":"https://github.com/bayofpigs","followers_url":"https://api.github.com/users/bayofpigs/followers","following_url":"https://api.github.com/users/bayofpigs/following{/other_user}","gists_url":"https://api.github.com/users/bayofpigs/gists{/gist_id}","starred_url":"https://api.github.com/users/bayofpigs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bayofpigs/subscriptions","organizations_url":"https://api.github.com/users/bayofpigs/orgs","repos_url":"https://api.github.com/users/bayofpigs/repos","events_url":"https://api.github.com/users/bayofpigs/events{/privacy}","received_events_url":"https://api.github.com/users/bayofpigs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-16T01:16:00Z","updated_at":"2015-07-16T02:09:28Z","closed_at":null,"body":"Pings, as specified in the RFC \"may serve either as a keepalive or **as a means to verify that the remote endpoint is still responsive**\". Currently when a Websocket connection sends out a ping, it does not make any attempt to remember that request. So when the pong eventually returns the connection [does essentially nothing](https://github.com/theturtle32/WebSocket-Node/blob/481648a7c8fe339f2dea64f84b66ba9fc2765540/lib/WebSocketConnection.js#L611-L613). This makes it difficult for the client to verify that a connection is active without setting \"assembleFragments\" to false and manually filtering for pongs (while wastefully assembling packets himself).   \r\n\r\nI think the easiest fix to this problem is to have the connection emit a \"sendping\" when a ping is sent and a \"pong\" when a pong is received, or something similar. The client is then able to tell when a particular peer is unresponsive, and possibly try to reconnect to or drop the peer. "},"comment":{"url":"https://api.github.com/repos/theturtle32/WebSocket-Node/issues/comments/121800583","html_url":"https://github.com/theturtle32/WebSocket-Node/issues/205#issuecomment-121800583","issue_url":"https://api.github.com/repos/theturtle32/WebSocket-Node/issues/205","id":121800583,"user":{"login":"theturtle32","id":53184,"avatar_url":"https://avatars.githubusercontent.com/u/53184?v=3","gravatar_id":"","url":"https://api.github.com/users/theturtle32","html_url":"https://github.com/theturtle32","followers_url":"https://api.github.com/users/theturtle32/followers","following_url":"https://api.github.com/users/theturtle32/following{/other_user}","gists_url":"https://api.github.com/users/theturtle32/gists{/gist_id}","starred_url":"https://api.github.com/users/theturtle32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theturtle32/subscriptions","organizations_url":"https://api.github.com/users/theturtle32/orgs","repos_url":"https://api.github.com/users/theturtle32/repos","events_url":"https://api.github.com/users/theturtle32/events{/privacy}","received_events_url":"https://api.github.com/users/theturtle32/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T02:09:27Z","updated_at":"2015-07-16T02:09:27Z","body":"Also, if we add a `pong` event, we should add a matching `ping` event as well, along with a way for the event handler to optionally bypass the built-in pong response functionality. This could be achieved by passing a `cancel` function as the second parameter to the `ping` event."}}