我有下面的JS代码,通过socketio客户端库连接到套接字非常有用:
userApi = 'userapiaccesfskdglk';
userAccess = 'useaccesfjkasdfdlkf2';
var axios = require('axios');
var socket = require('socket.io-client')('wss://test-meownow12345.com:4566');
socket.emit('Authenticate', {api: userApi, access: userAccess});
socket.on('Party', function(party) {
console.log('party', party)
})
这些不是实际使用的userApi、userAccess或url,但是使用它们仍然可以获得相同的意义。在
这是我在python中所拥有的,在我看来,它是一个精确的端口,但不起作用:
^{pr2}$它看起来是等效的,但显然不是这样,因为代码无法通过下面打开插座.io连接:
with SocketIO('wss://test-meownow12345.com', 4566, LoggingNamespace) as socketIO:
在我的控制台中,它会打印出以下重复的日志错误:
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): wss
WARNING:socketIO-client:wss:4566//test-meownow12345.com/socket.io [engine.io waiting for connection] HTTPConnectionPool(host='wss', port=4566): Max retries exceeded with url: //test-meownow12345.com/socket.io/?EIO=3&transport=polling&t=1523668232386-0 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x105000278>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))
我不太清楚这意味着什么。在
我尝试更改给出此消息的行,并删除“wss://”部分使其成为:
with SocketIO('test-meownow12345.com', 4566, LoggingNamespace) as socketIO:
但仍有一条新消息重复出现:
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): test-meownow12345.com
WARNING:socketIO-client:test-meownow12345.com:4566/socket.io [engine.io waiting for connection] ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))
DEBUG:urllib3.connectionpool:Starting new HTTP connection (2): test-meownow12345.com
DEBUG:urllib3.connectionpool:Starting new HTTP connection (3): test-meownow12345.com
任何帮助都是非常感谢的,这是一个相当令人沮丧的问题。在
如果您查看
SocketIO
类它继承自
^{pr2}$EngineIO
,后者的__init__
为而
parse_host
的定义是这表示用法如下所示
相关问题 更多 >
编程相关推荐