{"action":"closed","issue":{"url":"https://api.github.com/repos/enmasseio/timesync/issues/11","repository_url":"https://api.github.com/repos/enmasseio/timesync","labels_url":"https://api.github.com/repos/enmasseio/timesync/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/enmasseio/timesync/issues/11/comments","events_url":"https://api.github.com/repos/enmasseio/timesync/issues/11/events","html_url":"https://github.com/enmasseio/timesync/issues/11","id":214110253,"number":11,"title":"Rapid-fire sends regardless of interval.","user":{"login":"zimmed","id":2948531,"avatar_url":"https://avatars0.githubusercontent.com/u/2948531?v=4","gravatar_id":"","url":"https://api.github.com/users/zimmed","html_url":"https://github.com/zimmed","followers_url":"https://api.github.com/users/zimmed/followers","following_url":"https://api.github.com/users/zimmed/following{/other_user}","gists_url":"https://api.github.com/users/zimmed/gists{/gist_id}","starred_url":"https://api.github.com/users/zimmed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zimmed/subscriptions","organizations_url":"https://api.github.com/users/zimmed/orgs","repos_url":"https://api.github.com/users/zimmed/repos","events_url":"https://api.github.com/users/zimmed/events{/privacy}","received_events_url":"https://api.github.com/users/zimmed/received_events","type":"User","site_admin":false},"labels":[{"id":170515770,"url":"https://api.github.com/repos/enmasseio/timesync/labels/bug","name":"bug","color":"fc2929","default":true},{"id":170515773,"url":"https://api.github.com/repos/enmasseio/timesync/labels/help%20wanted","name":"help wanted","color":"159818","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-03-14T15:29:55Z","updated_at":"2017-08-19T11:55:50Z","closed_at":"2017-08-19T11:55:50Z","body":"I used the socket.io example to implement timesync using basic websockets (not a fan of socket.io's overhead and lack of binary buffers). Here is the gist of the implementation:\r\n\r\n**Server**\r\n```javascript\r\nsocket.on('timesync', data  => socket.send('timesync', {\r\n    id: data && data.id || null,\r\n    result: Date.now()\r\n}));\r\n```\r\n\r\n**Client**\r\n```javascript\r\nconst ts = require('timesync').create({server: socket});\r\nts.send = (socket, data) => socket.send('timesync', data); // Sends {jsonrpc: \"2.0\", id: null, result: <timestamp>}\r\nsocket.on('timesync', data => ts.receive(null, data)); // Receives {id: null, result: <timestamp>}\r\n```\r\n\r\nThe issue is that hundreds of timesync requests are being sent per second, even though each is receiving a correct response. I have tried `create({server: socket, interval: 5000})` as in the socket.io example, but am getting the same result. I'm not sure if I'm missing something, or if there's a bug. Any help would be appreciated."}}
{"actor":{"display_login":"josdejong"}}