You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thank you so for writing this package! I appreciate your work and it has been very helpful.
I have a simple socket.io emitter and listener I wrote that has been running for the past 6 months ago or so. I upgraded python from 2.7 to 3.3 and am now getting an odd error. The pared down code is as follows:
Python socketio-client emitter is:
from socketIO_client import SocketIO, LoggingNamespace
rapidssl = '<dir>/GT_RapidSSL_SHA-2_under_SHA-1_root_bundle.crt'
with SocketIO('https://<url>', 41777, LoggingNamespace, verify=rapidssl) as socketIO:
socketIO.emit('test', {'param1': '1', 'param2': 2})
socketIO.wait(seconds=1)
socketIO.disconnect()
Node socket.io listener:
var http = require('https')
var fs = require('fs')
var options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
// Send index.html to all requests
var server = http.createServer(options, function(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('here' );
});
// Socket.io server listens to our server
var io = require('socket.io').listen(server);
// Emit welcome message on connection
io.sockets.on('connection', function(socket) {
process.stdout.write('=-----------------------------------------------\n');
process.stdout.write('Got a connection\n');
console.log(socket.name + ' ' + socket.id + ' ' + socket.handshake.headers.origin + ' ' + socket.handshake.address + ' ' + socket.handshake.headers);
console.log( socket.handshake.headers );
socket.on("test", function(msg) {
var obj = eval(msg);
process.stdout.write('Got a test for ' + obj.param1 + ' ' + obj.param2 + '\n');
});
});
io.sockets.on('disconnect', function(socket) {
process.stdout.write('Disconnected!!\n');
});
server.listen(41777);
When I run the first script with with Python2.7 everything works fine. No errors and I get the proper output from the socket.on("test"...) part.
When I run the code with Python3.3 then I get errors:
socketIO_client.exceptions.ConnectionError: unexpected status code (400 {"code":1,"message":"Session ID unknown"})
The line in the socketIO-client python code is looking for a response of 200:
if 200 != status_code:
raise ConnectionError('unexpected status code (%s %s)' % (
status_code, response.text))
return response
It appears others have asked similar questions but I have not seen any responses that work. I have tried different machines, Python 3.3 and Python 3.4 and tried re-installing the node and socket.io via npm but to no avail. The really weird thing is that 1 in 10 times I run it in Python 3.3 it works. The other 9/10 times I get the above error.
Any ideas would be appreciated.
The text was updated successfully, but these errors were encountered:
Server certificate verification and client certificate encryption seem to work properly now (see #54). I haven't changed anything in the code, so I am assuming that there must have been a fix introduced in the requests library. Please check whether pip install -U requests fixes your issue.
First, thank you so for writing this package! I appreciate your work and it has been very helpful.
I have a simple socket.io emitter and listener I wrote that has been running for the past 6 months ago or so. I upgraded python from 2.7 to 3.3 and am now getting an odd error. The pared down code is as follows:
Python socketio-client emitter is:
When I run the first script with with Python2.7 everything works fine. No errors and I get the proper output from the socket.on("test"...) part.
When I run the code with Python3.3 then I get errors:
The line in the socketIO-client python code is looking for a response of 200:
It appears others have asked similar questions but I have not seen any responses that work. I have tried different machines, Python 3.3 and Python 3.4 and tried re-installing the node and socket.io via npm but to no avail. The really weird thing is that 1 in 10 times I run it in Python 3.3 it works. The other 9/10 times I get the above error.
Any ideas would be appreciated.
The text was updated successfully, but these errors were encountered: