Open cnbecom opened 7 years ago
Hey there! Wow, I did not think anybody would ever end up here! haha Glad you liked the tutorial :)
Unfortunately, this project is a few years old already... It could be a newer version of socketio or some other library I'm using? Maybe removing line https://github.com/irisSchaffer/rpi-socket-streaming/blob/master/index.js#L16 could make a difference? Are you receiving any error message with that 400 or literally just the "Bad Request"? I've found some other people having problems with socket.io and receiving 400s during WebSocket handshake (see here: https://github.com/socketio/socket.io/issues/1942), but not sure...
Please let me know if I can help you with anything else, but so far, I don't really have any leads and not even a rpi anywhere close by I could start-up :/
Commenting out the origin got me a step further, but this error is thrown:
/home/pi/node_programs/pistream/index.js:78 io.sockets.emit('live-stream', buffer.toString('base64')); ^ TypeError: Cannot read property 'toString' of undefined at ReadFileContext.callback (/home/pi/node_programs/pistream/index.js:78:46)
fs.readFile(getAbsoluteImagePath(), function(err, buffer){
io.sockets.emit('live-stream', buffer.toString('base64'));
});
Possibly an error?
if (err) {
// console log it here, if you want to know more about the error
io.socket.emit('error', error); // you'll have to add handling for 'error' in the front end
return
}
io.sockets.emit('live-stream', buffer.toString('base64'));
Great tutorial. I am trying to get this set up on my client. I have set appropriate addresses and ports from my pi3 and my client machine in the code. However, when the client attempts to connect to the server, upon launching the client.htmI and then clicking start stream, I receive a 400. (I added the * here). Obviously I have started the server as well.
http://10.40.100.*:9999/socket.io/?EIO=3&transport=polling&t=LcpJFDc 400 (Bad Request)
Any ideas on what I may have done wrong?