{"action":"created","issue":{"url":"https://api.github.com/repos/sockjs/sockjs-client/issues/285","repository_url":"https://api.github.com/repos/sockjs/sockjs-client","labels_url":"https://api.github.com/repos/sockjs/sockjs-client/issues/285/labels{/name}","comments_url":"https://api.github.com/repos/sockjs/sockjs-client/issues/285/comments","events_url":"https://api.github.com/repos/sockjs/sockjs-client/issues/285/events","html_url":"https://github.com/sockjs/sockjs-client/issues/285","id":127049490,"number":285,"title":"sockjs closes connection after 60 seconds","user":{"login":"norbertpy","id":10294525,"avatar_url":"https://avatars.githubusercontent.com/u/10294525?v=3","gravatar_id":"","url":"https://api.github.com/users/norbertpy","html_url":"https://github.com/norbertpy","followers_url":"https://api.github.com/users/norbertpy/followers","following_url":"https://api.github.com/users/norbertpy/following{/other_user}","gists_url":"https://api.github.com/users/norbertpy/gists{/gist_id}","starred_url":"https://api.github.com/users/norbertpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/norbertpy/subscriptions","organizations_url":"https://api.github.com/users/norbertpy/orgs","repos_url":"https://api.github.com/users/norbertpy/repos","events_url":"https://api.github.com/users/norbertpy/events{/privacy}","received_events_url":"https://api.github.com/users/norbertpy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-01-16T20:05:34Z","updated_at":"2016-02-26T22:14:17Z","closed_at":null,"body":"When connected to a server, I have noticed that the connection is closed automatically after **60 seconds**. It's between **59900 - 60100 ms** normally. I don't seem to find anything in the documentation regarding this.\r\n\r\n- Is this an expected behavior? \r\n- If not, how to prevent or debug it? \r\n- How can I have a long running connection? \r\n- Is this only valid for inactivity?\r\n\r\nThe heartbeat from server is set to 25 seconds by default but the `onheatbeat` function is only called once and that's during the connection initiation. Please note that I have disabled `websocket` protocol on the server and the client only uses the following protocols.\r\n\r\n```javascript\r\n// client.js\r\nvar sock = new SockJS('https://server/rt', null, {\r\n    transports: ['xdr-streaming', 'xhr-streaming', 'iframe-eventsource', \r\n                 'iframe-htmlfile', 'xdr-polling', 'xhr-polling', \r\n                 'iframe-xhr-polling', 'jsonp-polling'\r\n    ]\r\n});\r\n\r\nsock.onopen = function() {\r\n    console.log('open');\r\n};\r\n\r\nsock.onmessage = function(e) {\r\n    console.log('onmessage');\r\n};\r\n\r\nsock.onheartbeat = function() {\r\n    console.log('heartbeat'); // ONLY CALLED ONCE\r\n};\r\n\r\nsock.onclose = function() {\r\n    console.log('close');\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/sockjs/sockjs-client/issues/comments/189505212","html_url":"https://github.com/sockjs/sockjs-client/issues/285#issuecomment-189505212","issue_url":"https://api.github.com/repos/sockjs/sockjs-client/issues/285","id":189505212,"user":{"login":"tmds","id":1025424,"avatar_url":"https://avatars.githubusercontent.com/u/1025424?v=3","gravatar_id":"","url":"https://api.github.com/users/tmds","html_url":"https://github.com/tmds","followers_url":"https://api.github.com/users/tmds/followers","following_url":"https://api.github.com/users/tmds/following{/other_user}","gists_url":"https://api.github.com/users/tmds/gists{/gist_id}","starred_url":"https://api.github.com/users/tmds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmds/subscriptions","organizations_url":"https://api.github.com/users/tmds/orgs","repos_url":"https://api.github.com/users/tmds/repos","events_url":"https://api.github.com/users/tmds/events{/privacy}","received_events_url":"https://api.github.com/users/tmds/received_events","type":"User","site_admin":false},"created_at":"2016-02-26T22:14:17Z","updated_at":"2016-02-26T22:14:17Z","body":"So, now we can wonder why the server closes the connection in an inapproriate way...\r\nProbably the server side closes it due to inactivity. But the sockjs server implementation should avoid that by sending heartbeats. So perhaps something is not working properly on that end."}}