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

Can't connect to socket.io server: unexpected status code 404 #164

Open jpjamipark opened 7 years ago

jpjamipark commented 7 years ago

First off, thanks for writing this python library; it's a life-saver for my project.

I'm trying to connect to the IEX websocket server using this library with the example code (slightly modified):

from socketIO_client import SocketIO, BaseNamespace
import logging
logging.getLogger('socketIO-client').setLevel(logging.DEBUG)
logging.basicConfig()

from socketIO_client import SocketIO, LoggingNamespace

def on_connect():
    socketIO.emit('subscribe','snap')

def on_disconnect():
    print('disconnect')

def on_reconnect():
    print('reconnect')

socketIO = SocketIO('https://ws-api.iextrading.com/1.0', Namespace=LoggingNamespace, wait_for_connection=True, resource='last')
socketIO.on('connect', on_connect)
socketIO.on('disconnect', on_disconnect)
socketIO.on('reconnect', on_reconnect)

However every time I run this, I run into the following error:

WARNING:socketIO-client:ws-api.iextrading.com:443/1.0/tops [engine.io waiting for connection] unexpected status code (404 <!--#set var="title" value="404" -->
<!--#set var="page" value="404" -->

<!--#include virtual="/components/page.html" -->
)

The URL works fine on the javascript client:

const url = 'https://ws-api.iextrading.com:443/1.0/tops'
const socket = require('socket.io-client')(url)

socket.on('connect', () => {
  socket.emit('subscribe', 'snap')
})

How can I fix this issue? Does it have something to do with the commented out HTML?

jaredmcqueen commented 6 years ago

did you ever figure this out?

yccheok commented 6 years ago

Similar issues

https://github.com/invisibleroads/socketIO-client/issues/175

I use verify=False

Doesn't help much either.

addisonlynch commented 6 years ago

+1