question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

socketio.exceptions.ConnectionError: OPEN packet not returned by server

See original GitHub issue

I want to run my Socket-IO Client with Docker, but I get the following error message when trying to connect to my Socket-IO Server (written in JavaScript).

Traceback (most recent call last):
  File "client.py", line 14, in <module>
    sio.connect('http://' + server_address + ':3000')
  File "/usr/local/lib/python3.8/dist-packages/socketio/client.py", line 280, in connect
    raise exceptions.ConnectionError(exc.args[0]) from None
socketio.exceptions.ConnectionError: OPEN packet not returned by server

Socket-IO Client:

import socketio
import os, sys

# Connect to socket io server
sio = socketio.Client()

server_address = os.environ.get('SERVER_ADDRESS')
if server_address:
    print('http://' + server_address + ':3000')
    sio.connect('http://' + server_address + ':3000')
else:
    sio.connect('http://<default ip>:3000')

Dockerfile:

FROM ubuntu:latest

ARG SERVER_ADDRESS
ENV SERVER_ADDRESS $SERVER_ADDRESS

RUN apt-get update -y && apt-get install -y python3 python3-pip

RUN pip3 install pyserial python-socketio requests

COPY ./flir-config .

COPY ./find_serial_device.py .

CMD ["python3", "client.py"]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

32reactions
TannerGilbertcommented, Jan 4, 2021

@Nathan1258 My Socket.IO server is written in JavaScript using socket.io v.2.3.0. To communicate with the server in Python, the right versions for python-socketio and python-engineio need to be chosen.

image

In my case, I forgot to fix the python-engineio version to 3.x, which resulted in the error. To fix it, I installed version 3.14.2.

pip install python-engineio==3.14.2 python-socketio[client]==4.6.0
6reactions
miguelgrinbergcommented, Dec 14, 2020

did you pin the version of python-engineio to a compatible version? It should be a 3.x for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python socketio - open packet not returned by the server
client connected {client_id}. but on my client side (python-socketio client) it returns exceptions. OPEN Packet not returned by the server.
Read more >
Troubleshooting connection issues | Socket.IO
First and foremost, please note that disconnections are common and expected, even on a stable Internet connection:
Read more >
The Socket.IO Server — python-socketio documentation
To install the Socket.IO server along with its dependencies, use the following command: ... In that case instead of returning False socketio.exceptions.
Read more >
socketio.exceptions.ConnectionError: OPEN packet not ...
socketio.exceptions.ConnectionError: OPEN packet not returned by server. 报错信息Exception in thread Thread-3:Traceback (most recent call last): ...
Read more >
python socketio - open packet not returned by the server-django
Could anyone please help me explain why I got this exceptions? I have been doing what the docs said. score:0. client installed python-engineio-4.0 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found