-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
I'm trying to connect with Micropython flashed ESP32 to my Flask-Socketio server running on gunicorn, but when connuecting I'm getting this error:
import usocketio.client
usocketio.client.connect('http://192.168.0.108:5000')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "usocketio/client.py", line 80, in connect
File "usocketio/client.py", line 67, in _connect_http
File "usocketio/client.py", line 61, in _connect_http
AssertionError:
It looks like it failing in _connect_http() function because length variable is None:
def _connect_http(hostname, port, path):
"""Stage 1 do the HTTP connection to get our SID"""
try:
sock = socket.socket()
addr = socket.getaddrinfo(hostname, port)
sock.connect(addr[0][4])
def send_header(header, *args):
if __debug__:
LOGGER.debug(str(header), *args)
sock.write(header % args + '\r\n')
send_header(b'GET %s HTTP/1.1', path)
send_header(b'Host: %s:%s', hostname, port)
send_header(b'')
header = sock.readline()[:-2]
assert header == b'HTTP/1.1 200 OK', header
length = None
while header:
header = sock.readline()[:-2]
if not header:
break
header, value = header.split(b': ')
header = header.lower()
if header == b'content-type':
assert value == b'application/octet-stream'
elif header == b'content-length':
length = int(value)
assert length # <--- failing on this line
data = sock.read(length)
return decode_payload(data)
finally:
sock.close()Any ideas what could be wrong here?
Metadata
Metadata
Assignees
Labels
No labels