invisibleroads / socketIO-client

A socket.io client library for Python
http://pypi.python.org/pypi/socketIO-client
MIT License
447 stars 205 forks source link

"[connection error] recv disconnected" when I use HTTPS #191

Closed ghost closed 6 years ago

ghost commented 6 years ago

I am trying to make this work correctly with HTTPS but I do not know why it only works as it is supposed to with HTTP.

This is my code (client.py)

import time
from socketIO_client import SocketIO

from random import randint

import logging
logging.getLogger('socketIO-client').setLevel(logging.DEBUG)
logging.basicConfig()

def callback(message):
    pass

if __name__ == '__main__':
    socketIO = SocketIO('https://example.com', 5301)

    while True:
        socketIO.emit('update_tjhrfgjrtytyj', [randint(0, 100)], callback)
        socketIO.wait_for_callbacks(5)
        time.sleep(0.25)

With HTTP it works correctly but when I use HTTPS it works in the first seconds and then gives this error:

WARNING:socketIO-client:example.com:5301/socket.io [connection error] recv disconnected ([Errno 11] Resource temporarily unavailable)

Complete log: https://pastebin.com/nUNVjEzW Sometimes the error happens later sometimes earlier. It also continues to execute but with a delay of 5 seconds each is unacceptable.

The server code if it matters: https://pastebin.com/DT6zLwLt

ghost commented 6 years ago

I tried in another computer and it seems to be working. Sometimes it gives an error related to SSLv3 and I have to try again to start the script but it still works.