{"action":"closed","issue":{"url":"https://api.github.com/repos/dcodeIO/protobuf.js/issues/385","labels_url":"https://api.github.com/repos/dcodeIO/protobuf.js/issues/385/labels{/name}","comments_url":"https://api.github.com/repos/dcodeIO/protobuf.js/issues/385/comments","events_url":"https://api.github.com/repos/dcodeIO/protobuf.js/issues/385/events","html_url":"https://github.com/dcodeIO/protobuf.js/issues/385","id":125779806,"number":385,"title":"How to deal with streams? ","user":{"login":"ariporad","id":1817508,"avatar_url":"https://avatars.githubusercontent.com/u/1817508?v=3","gravatar_id":"","url":"https://api.github.com/users/ariporad","html_url":"https://github.com/ariporad","followers_url":"https://api.github.com/users/ariporad/followers","following_url":"https://api.github.com/users/ariporad/following{/other_user}","gists_url":"https://api.github.com/users/ariporad/gists{/gist_id}","starred_url":"https://api.github.com/users/ariporad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ariporad/subscriptions","organizations_url":"https://api.github.com/users/ariporad/orgs","repos_url":"https://api.github.com/users/ariporad/repos","events_url":"https://api.github.com/users/ariporad/events{/privacy}","received_events_url":"https://api.github.com/users/ariporad/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-01-09T20:27:01Z","updated_at":"2016-01-10T03:36:10Z","closed_at":"2016-01-10T03:36:10Z","body":"Hi, Thanks so much for making such an awesome library!\r\n\r\nQuick question though, what's the recommended method for dealing with sockets? Are you supposed to do something like this?:\r\n\r\n```javascript\r\nvar chunks = [];\r\nvar lengthLeft;\r\nsocket.on('data', function (chunk) {\r\n    var len = chunk.length;\r\n    if (chunk.length < lengthLeft) return; chunks.push(chunk);\r\n    // parse chunks\r\n});\r\n```\r\n\r\nOr is there a built in method to do this?\r\n\r\nThanks!"}}