Python WebSocket通道 - 由对等方重置连接

时间:2017-11-03 18:39:39

标签: python websocket python-requests python-sockets

我想构建自己的库用于服务器 - >浏览器通过websockets进行通信。我试图建立一些东西,就在这里:https://github.com/duverse/wsc。但有时,当我尝试将API调用发送到我自己的服务器时,我有类似的东西:

Python请求

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/project/.venv/local/lib/python2.7/site-packages/wsc/client/__init__.py", line 109, in stat
    'Access-Key': self._access_key
  File "/project/.venv/local/lib/python2.7/site-packages/requests/api.py", line 72, in get
    return request('get', url, params=params, **kwargs)
  File "/project/.venv/local/lib/python2.7/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/project/.venv/local/lib/python2.7/site-packages/requests/sessions.py", line 502, in request
    resp = self.send(prep, **send_kwargs)
  File "/project/.venv/local/lib/python2.7/site-packages/requests/sessions.py", line 612, in send
    r = adapter.send(request, **kwargs)
  File "/project/.venv/local/lib/python2.7/site-packages/requests/adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))

我认为问题在于此方法:https://github.com/duverse/wsc/blob/master/wsc/server/request.py#L113,因为所有websocket连接都可以正常工作。通常它可能会尝试接收空的包。我不确定。

P.S。我使用过SSLSocket,来自websocket请求的包总是被拆分。它第一次总是只向我发送一个字节,然后是另一个字节。

P.P.S。 WSC服务器日志就是它:

WSC.log

----------------------------------------
Exception happened during processing of request from ('123.123.123.123', 45757)
----------------------------------------

没有痕迹。 (ip被替换)

0 个答案:

没有答案