{"action":"created","issue":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3211","labels_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3211/labels{/name}","comments_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3211/comments","events_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3211/events","html_url":"https://github.com/Starcounter/Starcounter/issues/3211","id":123262613,"number":3211,"title":"WebSocketDisconnected event","user":{"login":"careri","id":4263597,"avatar_url":"https://avatars.githubusercontent.com/u/4263597?v=3","gravatar_id":"","url":"https://api.github.com/users/careri","html_url":"https://github.com/careri","followers_url":"https://api.github.com/users/careri/followers","following_url":"https://api.github.com/users/careri/following{/other_user}","gists_url":"https://api.github.com/users/careri/gists{/gist_id}","starred_url":"https://api.github.com/users/careri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/careri/subscriptions","organizations_url":"https://api.github.com/users/careri/orgs","repos_url":"https://api.github.com/users/careri/repos","events_url":"https://api.github.com/users/careri/events{/privacy}","received_events_url":"https://api.github.com/users/careri/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Starcounter/Starcounter/labels/question","name":"question","color":"02d7e1"}],"state":"open","locked":false,"assignee":{"login":"alemoi","id":208134,"avatar_url":"https://avatars.githubusercontent.com/u/208134?v=3","gravatar_id":"","url":"https://api.github.com/users/alemoi","html_url":"https://github.com/alemoi","followers_url":"https://api.github.com/users/alemoi/followers","following_url":"https://api.github.com/users/alemoi/following{/other_user}","gists_url":"https://api.github.com/users/alemoi/gists{/gist_id}","starred_url":"https://api.github.com/users/alemoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alemoi/subscriptions","organizations_url":"https://api.github.com/users/alemoi/orgs","repos_url":"https://api.github.com/users/alemoi/repos","events_url":"https://api.github.com/users/alemoi/events{/privacy}","received_events_url":"https://api.github.com/users/alemoi/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-12-21T11:47:04Z","updated_at":"2015-12-21T15:47:03Z","closed_at":null,"body":"I've got a working websocket that I write/read from using a c# client app. \r\nIf  I call (System.Net.WebSockets.ClientWebSocket).CloseAsync on the client the event is triggered as expected.\r\n\r\nA few questions about the disconnected event:\r\n1. But what if the client just dies, will that event ever be triggered? \r\n2. Is there a timeout that will trigger the event?\r\n3. Do I need to implement a heartbeat to monitor the ws myself?\r\n\r\nThe event:\r\n```\r\nHandle.WebSocketDisconnect(s_port, UL_ChannelName, ws =>\r\n{\r\n    var cargoId = ws.ToUInt64();\r\n    Debug.WriteLine(\"Server.ws{0}.Disconnected\", cargoId);\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/comments/166335370","html_url":"https://github.com/Starcounter/Starcounter/issues/3211#issuecomment-166335370","issue_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3211","id":166335370,"user":{"login":"alemoi","id":208134,"avatar_url":"https://avatars.githubusercontent.com/u/208134?v=3","gravatar_id":"","url":"https://api.github.com/users/alemoi","html_url":"https://github.com/alemoi","followers_url":"https://api.github.com/users/alemoi/followers","following_url":"https://api.github.com/users/alemoi/following{/other_user}","gists_url":"https://api.github.com/users/alemoi/gists{/gist_id}","starred_url":"https://api.github.com/users/alemoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alemoi/subscriptions","organizations_url":"https://api.github.com/users/alemoi/orgs","repos_url":"https://api.github.com/users/alemoi/repos","events_url":"https://api.github.com/users/alemoi/events{/privacy}","received_events_url":"https://api.github.com/users/alemoi/received_events","type":"User","site_admin":false},"created_at":"2015-12-21T15:47:03Z","updated_at":"2015-12-21T15:47:03Z","body":"Thank you for your questions!\r\n\r\n> 1. But what if the client just dies, will that event ever be triggered? \r\n\r\nYes, if connection socket dies, then you will get a disconnect event.\r\n\r\n> 2. Is there a timeout that will trigger the event?\r\n\r\nNo. Its for the lifetime of the socket.\r\n\r\n> 3. Do I need to implement a heartbeat to monitor the ws myself?\r\n\r\nYes. For example, we have such custom implementation in Puppets: https://github.com/Starcounter/Starcounter/issues/3084\r\n\r\nLet us know if anything regarding disconnect event is not working for you."}}