Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'uid' of null #20

Closed
zoell opened this issue Jan 9, 2016 · 3 comments
Closed

TypeError: Cannot read property 'uid' of null #20

zoell opened this issue Jan 9, 2016 · 3 comments

Comments

@zoell
Copy link

zoell commented Jan 9, 2016

Using the following code to send a file from a node.js backend:

var ioClient = require('socket.io-client');
var socket = ioClient.connect('http://' + host);
socket.on('connect', function() {
    delivery = dl.listen(socket);
    delivery.connect();
    delivery.on('delivery.connect', function(delivery){
        delivery.send({
            name: file_name,
            path : file_path
        });
        delivery.on('send.success', function(file){
            // something....
        });
    });
});

To this server:

var io  = require('socket.io').listen(5001);
io.sockets.on('connection', function(socket){
  var delivery = dl.listen(socket);
  delivery.on('receive.success',function(file){
      // something...
  });
});

Results the following error:

2016-01-08T23:59:06.846533210Z Missing error handler on `socket`.
2016-01-08T23:59:06.846544375Z TypeError: Cannot read property 'uid' of null
2016-01-08T23:59:06.846547082Z     at Array. (/src/node_modules/delivery/lib/delivery.server.js:124:42)
2016-01-08T23:59:06.846549676Z     at PubSub.publish (/src/node_modules/delivery/lib/delivery.server.js:27:11)
2016-01-08T23:59:06.846551777Z     at Socket. (/src/node_modules/delivery/lib/delivery.server.js:155:18)
2016-01-08T23:59:06.846553851Z     at emitOne (events.js:77:13)
2016-01-08T23:59:06.846555769Z     at Socket.emit (events.js:169:7)
2016-01-08T23:59:06.846557679Z     at Socket.onevent (/src/node_modules/socket.io/lib/socket.js:335:8)
2016-01-08T23:59:06.846559655Z     at Socket.onpacket (/src/node_modules/socket.io/lib/socket.js:295:12)
2016-01-08T23:59:06.846561625Z     at Client.ondecoded (/src/node_modules/socket.io/lib/client.js:193:14)
2016-01-08T23:59:06.846564037Z     at Decoder.Emitter.emit (/src/node_modules/socket.io/node_modules/socket.io-parser/node_modules/component-emitter/index.js:134:20)
2016-01-08T23:59:06.846566300Z     at Decoder.add (/src/node_modules/socket.io/node_modules/socket.io-parser/index.js:247:12)

The file json data is the following received on the server side:

{"name":"filename.txt","pubSub":{"channels":{"receive.success":[null,null],"file.load":[null]}},"data":"
...... FILE_DATA_HERE.......
]}}

Is there anything I am missing here?

@liamks
Copy link
Owner

liamks commented Jan 11, 2016

var socket = ioClient.connect('http://' + host); where is host defined? Although if the fine is received then obviously the host is defined? Not sure what is going wrong. Sorry! You'll have to dig into the library where the error is occurring.

@dechristopher
Copy link

I'm getting this error as well. Any help would be appreciated.

@Arrow7000
Copy link
Contributor

This is fixed as of version 0.0.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants