{"action":"created","issue":{"url":"https://api.github.com/repos/liamks/Delivery.js/issues/19","repository_url":"https://api.github.com/repos/liamks/Delivery.js","labels_url":"https://api.github.com/repos/liamks/Delivery.js/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/liamks/Delivery.js/issues/19/comments","events_url":"https://api.github.com/repos/liamks/Delivery.js/issues/19/events","html_url":"https://github.com/liamks/Delivery.js/issues/19","id":123809887,"number":19,"title":"Missing error handler and pubSub not defined","user":{"login":"farayman3","id":16428516,"avatar_url":"https://avatars.githubusercontent.com/u/16428516?v=3","gravatar_id":"","url":"https://api.github.com/users/farayman3","html_url":"https://github.com/farayman3","followers_url":"https://api.github.com/users/farayman3/followers","following_url":"https://api.github.com/users/farayman3/following{/other_user}","gists_url":"https://api.github.com/users/farayman3/gists{/gist_id}","starred_url":"https://api.github.com/users/farayman3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/farayman3/subscriptions","organizations_url":"https://api.github.com/users/farayman3/orgs","repos_url":"https://api.github.com/users/farayman3/repos","events_url":"https://api.github.com/users/farayman3/events{/privacy}","received_events_url":"https://api.github.com/users/farayman3/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2015-12-24T14:46:35Z","updated_at":"2016-09-14T22:20:54Z","closed_at":"2015-12-31T20:30:32Z","body":"Hi,\r\n\r\nThanks a lot for delivery. I've got it working and files are being send (server to server) however I get an annoying error message every time:\r\n\r\nMissing error handler on `socket`.\r\nReferenceError: pubSub is not defined\r\n    at Socket.<anonymous> (/Users/thijsnieuwkoop/node_modules/delivery/lib/delivery.server.js:125:5)\r\n    at emitOne (events.js:77:13)\r\n    at Socket.emit (events.js:169:7)\r\n    at Socket.onevent (/Users/thijsnieuwkoop/node_modules/socket.io/lib/socket.js:330:8)\r\n    at Socket.onpacket (/Users/thijsnieuwkoop/node_modules/socket.io/lib/socket.js:290:12)\r\n    at Client.ondecoded (/Users/thijsnieuwkoop/node_modules/socket.io/lib/client.js:193:14)\r\n    at Decoder.Emitter.emit (/Users/thijsnieuwkoop/node_modules/socket.io/node_modules/socket.io-parser/node_modules/component-emitter/index.js:134:20)\r\n    at Decoder.add (/Users/thijsnieuwkoop/node_modules/socket.io/node_modules/socket.io-parser/index.js:247:12)\r\n    at Client.ondata (/Users/thijsnieuwkoop/node_modules/socket.io/lib/client.js:175:18)\r\n    at emitOne (events.js:77:13)\r\n    at Socket.emit (events.js:169:7)\r\n    at Socket.onPacket (/Users/thijsnieuwkoop/node_modules/socket.io/node_modules/engine.io/lib/socket.js:99:14)\r\n    at emitOne (events.js:77:13)\r\n    at XHR.emit (events.js:169:7)\r\n    at XHR.Transport.onPacket (/Users/thijsnieuwkoop/node_modules/socket.io/node_modules/engine.io/lib/transport.js:91:8)\r\n    at callback (/Users/thijsnieuwkoop/node_modules/socket.io/node_modules/engine.io/lib/transports/polling.js:202:10)\r\n\r\nWhat is going on?\r\n\r\n\r\nServer side:\r\n    io.sockets.on('connection', function(socket){\r\n      var delivery = dl.listen(socket);\r\n      delivery.on('receive.success', function(file){\r\n        fs.writeFile(file.name, file.buffer, function(err2){\r\n          if (err2){\r\n            console.log('File could not be saved: '+err2);\r\n          } else {\r\n            console.log('File '+file.name+' saved')\r\n          }\r\n        });\r\n      });\r\n    });"},"comment":{"url":"https://api.github.com/repos/liamks/Delivery.js/issues/comments/247174974","html_url":"https://github.com/liamks/Delivery.js/issues/19#issuecomment-247174974","issue_url":"https://api.github.com/repos/liamks/Delivery.js/issues/19","id":247174974,"user":{"login":"Arrow7000","id":13225609,"avatar_url":"https://avatars.githubusercontent.com/u/13225609?v=3","gravatar_id":"","url":"https://api.github.com/users/Arrow7000","html_url":"https://github.com/Arrow7000","followers_url":"https://api.github.com/users/Arrow7000/followers","following_url":"https://api.github.com/users/Arrow7000/following{/other_user}","gists_url":"https://api.github.com/users/Arrow7000/gists{/gist_id}","starred_url":"https://api.github.com/users/Arrow7000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Arrow7000/subscriptions","organizations_url":"https://api.github.com/users/Arrow7000/orgs","repos_url":"https://api.github.com/users/Arrow7000/repos","events_url":"https://api.github.com/users/Arrow7000/events{/privacy}","received_events_url":"https://api.github.com/users/Arrow7000/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T22:20:54Z","updated_at":"2016-09-14T22:20:54Z","body":"Hi, I'm getting the same issue when connecting from server to server. The file transmission does seem to work perfectly though so I don't understand what the error would be. \r\n\r\nHere's my code:\r\n\r\n**Sending server:**\r\n\r\n```\r\n'use strict';\r\nconst io = require('socket.io-client'),\r\n    dl = require('delivery');\r\n\r\nconst socket = io.connect('http://localhost:5001');\r\n\r\nsocket.on('connect', function() {\r\n    console.log(\"Sockets connected\");\r\n\r\n    var delivery = dl.listen(socket);\r\n    delivery.connect();\r\n\r\n    delivery.on('delivery.connect', function(delivery) {\r\n        delivery.send({\r\n            name: 'video.mkv',\r\n            path: './video.mkv'\r\n        });\r\n\r\n        delivery.on('send.success', function(file) {\r\n            console.log('File sent successfully!');\r\n        });\r\n    });\r\n\r\n}); \r\n```\r\n\r\n**Receiving server:**\r\n\r\n```\r\n'use strict';\r\nconst io = require('socket.io').listen(5001),\r\n    dl = require('delivery'),\r\n    fs = require('fs');\r\n\r\nio.sockets.on('connection', function(socket) {\r\n    var delivery = dl.listen(socket);\r\n    delivery.on('receive.success', function(file) {\r\n\r\n        fs.writeFile(file.name, file.buffer, function(err) {\r\n            if (err) {\r\n                console.log('File could not be saved: ' + err);\r\n            } else {\r\n                console.log('File ' + file.name + \" saved\");\r\n            };\r\n        });\r\n    });\r\n});\r\n\r\nio.sockets.on('error', function(err) {\r\n    console.log('Error ocurred:', err);\r\n});\r\n```\r\n\r\nThe sender only logs this to the console: `Sockets connected`; the `File sent successfully!` log never appears.\r\n\r\nThe receiver logs this:\r\n\r\n```\r\nMissing error handler on `socket`.\r\nTypeError: Cannot read property 'uid' of null\r\n    at Array.<anonymous> (C:\\Users\\Aron\\Documents\\Programming Projects\\Tracker-3\\server\\node_modules\\delivery\\lib\\delivery.server.js:124:42)\r\n    at PubSub.publish (C:\\Users\\Aron\\Documents\\Programming Projects\\Tracker-3\\server\\node_modules\\delivery\\lib\\delivery.server.js:27:11)\r\n    at Socket.<anonymous> (C:\\Users\\Aron\\Documents\\Programming Projects\\Tracker-3\\server\\node_modules\\delivery\\lib\\delivery.server.js:155:18)\r\n    at emitOne (events.js:96:13)\r\n    at Socket.emit (events.js:188:7)\r\n    at Socket.onevent (C:\\Users\\Aron\\Documents\\Programming Projects\\Tracker-3\\server\\node_modules\\socket.io\\lib\\socket.js:335:8)\r\n    at Socket.onpacket (C:\\Users\\Aron\\Documents\\Programming Projects\\Tracker-3\\server\\node_modules\\socket.io\\lib\\socket.js:295:12)\r\n    at Client.ondecoded (C:\\Users\\Aron\\Documents\\Programming Projects\\Tracker-3\\server\\node_modules\\socket.io\\lib\\client.js:193:14)\r\n    at Decoder.Emitter.emit (C:\\Users\\Aron\\Documents\\Programming Projects\\Tracker-3\\server\\node_modules\\component-emitter\\index.js:134:20)\r\n    at Decoder.add (C:\\Users\\Aron\\Documents\\Programming Projects\\Tracker-3\\server\\node_modules\\socket.io-parser\\index.js:247:12)\r\nFile video.mkv saved\r\n```\r\n\r\nAny idea as to what's going wrong? Thank you"}}
{"actor":{"display_login":"Arrow7000"}}