invisibleroads / invisibleroads/socketIO-client

Connect to socket.io server using https

Open
#175 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
441
Forks
204
PR merge metrics
No merged PRs in 30d

Description

Thank you for creating this socket.io python library.

Previously, I have a JavaScript socket.io client application as follow

```

console.log("start");

var socket = io('https://ws-api.iextrading.com/1.0/tops');

// Listen to the channel's messages
socket.on('message', message => console.log(message));

// Connect to the channel
socket.on('connect', () => {
console.log("connect");

// Subscribe to topics (i.e. appl,fb,aig+)
socket.emit('subscribe', 'snap,fb,aig+');

// Unsubscribe from topics (i.e. aig+)
socket.emit('unsubscribe', 'aig+');
});

// Disconnect from the channel
socket.on('disconnect', () => console.log('Disconnected.'));

```

Just save it as HTML, and open with chrome. I can get

> start
> connect

Now, I want to port the client application running in python environment

```
from socketIO_client import SocketIO, LoggingNamespace

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

def on_message():
print('message')

def on_connect():
print('connect')

def on_disconnect():
print('disconnect')

print("debug 0")
socketIO = SocketIO(host='https://ws-api.iextrading.com/1.0/tops', verify=False)

print("debug 1")
socketIO.on('message', on_message)

print("debug 2")
socketIO.on('connect', on_connect)

print("debug 3")
socketIO.on('disconnect', on_disconnect)

print("debug 4")
```
The code stucks at `socketIO = SocketIO(...`. What I get is

> debug 0
> C:\yocto\sandbox\venv\lib\site-packages\urllib3\connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
> InsecureRequestWarning)
> WARNING:socketIO-client:ws-api.iextrading.com:443/1.0/tops/socket.io [engine.io waiting for connection] unexpected status code (404 Not Found)
> C:\yocto\sandbox\venv\lib\site-packages\urllib3\connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
> InsecureRequestWarning)
> C:\yocto\sandbox\venv\lib\site-packages\urllib3\connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
> InsecureRequestWarning)

May I know what I can do to get this fixed? As, my Javascript client code works OK with server. Hence, by dealing with same server, I expect Python socketIO-client works as well.

Thanks

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.