SocketIO client cannot connect to server

I am currently trying to connect to socketIO server, as in this JavaScript:

var socket = io('https://beta.glws.org')

This is the part of Python that does not work:

from socketIO_client import SocketIO, BaseNamespace

s = SocketIO('https://beta.glws.org', 80,
             verify=False,
             headers={'Sec-WebSocket-Key': 'BtvJh6zvB4ILSo0sqIOntQ=='},
             cookies={'io': 'SCdIBbDOGDXhUBOZAkhM',
                      'gat': '1',
                      'ga': 'GA1.2.1442748168.1463601401'
                      },
             )

Cookies and headers are downloaded from debugging from the production site, but the result is the same as without them.

Result with debug level logging:

INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): beta.glws.org
WARNING:root:beta.glws.org:80/socket.io [waiting for connection] [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:590)
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (2): beta.glws.org
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (3): beta.glws.org
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (4): beta.glws.org
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (5): beta.glws.org
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (6): beta.glws.org
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (7): beta.glws.org

What am I doing wrong? Why is he launching so many new https connections?

+4
source share
1 answer

I believe the problem is that you are specifying an https address when using port 80. Port 80 is for http and port 443 is for https.

Here is the part of the line of code that you should change.

'https://beta.glws.org', 80,

http 80, 443 .

+3

All Articles