Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socketio 2.0 #6

Open
wants to merge 15 commits into
base: release
Choose a base branch
from
Open

Socketio 2.0 #6

wants to merge 15 commits into from

Conversation

juhhov
Copy link

@juhhov juhhov commented Aug 2, 2018

Target is to support 1.x and 2.x socketio versions. Need to figure out how to detect which version server is running.

@juhhov juhhov requested a review from jupe August 2, 2018 10:36
@juhhov juhhov changed the base branch from merge-upstream to master August 17, 2018 07:35
except UnicodeDecodeError as error:
if self.bw_comp:
raise error

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trace would be good here

@juhhov juhhov changed the base branch from master to release August 20, 2018 09:39
Copy link

@jonikula jonikula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments.

socketIO_client/__init__.py Show resolved Hide resolved
socketIO_client/__init__.py Show resolved Hide resolved
socketIO_client/transports.py Outdated Show resolved Hide resolved
socketIO_client/transports.py Outdated Show resolved Hide resolved
socketIO_client/transports.py Outdated Show resolved Hide resolved
@Hernrup
Copy link

Hernrup commented Nov 28, 2018

Hi, do you have any progress estimates on if and when this will get accepted? We are strugling with finding a working python client for socketio 2.x. Thanks!

@jupe
Copy link

jupe commented Nov 28, 2018

@juhhov ready for merging?

@jupe
Copy link

jupe commented Nov 28, 2018

@Hernrup have you tried this PR yet - does it work in your case? double e2e testing would be more than welcome :)

@Hernrup
Copy link

Hernrup commented Nov 28, 2018

@jupe actually no but I'll give it a try when I get to work tomorrow and let you know how it goes!

@Hernrup
Copy link

Hernrup commented Nov 29, 2018

Im sorry to say that my issues persist with the new version.
I have not ruled out that its not something in my environment but this is what im experiencing at the moment for your information and feedback.

Server

python-socketio==2.0.0

Test client

class OutboundNamespace(BaseNamespace):
    def on_connect(self):
        print('Client [Connected]')

    def on_disconnect(self):
        print('Client [Disconnected]')

    def on_event(self, event, *args):
        logger.info('client trigger event [{}]: {}'.format(event, args))


socket = outbound_socket = socketIO_client.SocketIO(
        'http://api-gateway:9999/applications/socket',
        9999, OutboundNamespace, transports=['websocket'])

socket.wait()

Result

2018-11-29 08:57:01,373 - root - DEBUG - [heartbeat connection error]
Traceback (most recent call last):
  File "/tmp/socketIO-client/socketIO_client/transports.py", line 157, in __init__
    self._connection = create_connection(ws_url, **kw)
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 511, in create_connection
    websock.connect(url, **options)
  File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 223, in connect
    self.handshake_response = handshake(self.sock, *addrs, **options)
  File "/usr/lib/python3.5/site-packages/websocket/_handshake.py", line 79, in handshake
    status, resp = _get_resp_headers(sock)
  File "/usr/lib/python3.5/site-packages/websocket/_handshake.py", line 152, in _get_resp_headers
    raise WebSocketBadStatusException("Handshake status %d %s", status, status_message)
websocket._exceptions.WebSocketBadStatusException: Handshake status 400 BAD REQUEST

It immediately falls back to 1.0 and then chooses polling as transport when handshake can not be established.

Some basic polling over GET seems to work

api-applications_1   | 2018-11-29T09:08:24.337387762+01:00 uwsgi 17 [UWSGI]: 10.98.0.4 - - [29/Nov/2018:09:08:24 +0100] "POST /applications/socket/socket.io/?t=1543478904332-1&sid=8559e0f4c90040219185c57d9e4fc432&transport=polling&EIO=3 HTTP/1.1" 400 137 "-" "python-requests/2.20.1"

But some over post fails (wrong protocal? socketIO 1.x?)

api-applications_1   | 2018-11-29T09:08:24.337387762+01:00 uwsgi 17 [UWSGI]: 10.98.0.4 - - [29/Nov/2018:09:08:24 +0100] "POST /applications/socket/socket.io/?t=1543478904332-1&sid=8559e0f4c90040219185c57d9e4fc432&transport=polling&EIO=3 HTTP/1.1" 400 137 "-" "python-requests/2.20.1"

Ill keep digging but this might provide you with some more insite. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants