Skip to content

Remove unnecessary decode from received package#158

Open
oguzhanogreden wants to merge 2 commits into
invisibleroads:masterfrom
oguzhanogreden:master
Open

Remove unnecessary decode from received package#158
oguzhanogreden wants to merge 2 commits into
invisibleroads:masterfrom
oguzhanogreden:master

Conversation

@oguzhanogreden

@oguzhanogreden oguzhanogreden commented May 26, 2017

Copy link
Copy Markdown

Fixes #155.

See here for why this works. Ultimately, my commit can lead to a bit more simplification of the code. Thought I'd leave that for @invisibleroads seeing that there is a 8.0.0 branch.

Nakroma added a commit to nexus-devs/socketIO-client-2.0.3 that referenced this pull request Jun 12, 2017
@Nakroma

Nakroma commented Jun 12, 2017

Copy link
Copy Markdown

Since this package doesn't seem to be worked on very much, I went ahead and forked it and implemented your fixes. For anyone interested working with 2.x you can use it with pip install socketIO-client-nexus while we wait for 8.0 or another package to add 2.x support.
https://github.com/nexus-devs/socketIO-client

@MisterWil

Copy link
Copy Markdown

This pull still has an issue with unicode handling in the _read_packet_text def in parsers.py. The last two lines need to pull the packet_text using the decoded contents and then re-encode the packet_text.

packet_text = content.decode()[content_index:content_index + packet_length]
return content_index + packet_length, packet_text.encode()

Nakroma added a commit to nexus-devs/socketIO-client-2.0.3 that referenced this pull request Jun 13, 2017

@andresarcila andresarcila left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this worked for me, I upgraded Node from v0.42 to version 6.11.3 and my application in python stopped working. I applied this pull request and everything worked again

@lofcodes

Copy link
Copy Markdown

This worked for me, thanks. Node 6, npm "socket.io": "^2.0.3", python 3 socketIO-client-nexus==0.7.5

@AmazingRaise

Copy link
Copy Markdown

socketio/socket.io#2833
socket.io(version 2.0.x ):Merge Engine.IO and Socket.IO handshake packets; so read the packet error.It means do as Socket.IO do?

zheli pushed a commit to zheli/socketIO-client-2 that referenced this pull request Nov 12, 2017
@wilsonge

wilsonge commented Jan 3, 2018

Copy link
Copy Markdown

Out of interest does this fix the issue described in #129 (comment) ?

@BenWoodford

Copy link
Copy Markdown

@Nakroma I tried using the nexus package but was still getting the StopIteration error but only on Python >=3.5

I guess this issue is still up in the air?

@Nakroma

Nakroma commented Jan 11, 2018

Copy link
Copy Markdown

@BenWoodford could you give me a code snippet for reproduction? I'm on python 3.6.3 and it works for me

@BenWoodford

Copy link
Copy Markdown

Perhaps it’s a different issue with the same symptom then... I’m tinkering with the pyloopenergy library and that’s what’s throwing a StopIteration (as per this home-assistant/core#8137 (comment))

Hmm

@pavoni

pavoni commented Jan 11, 2018

Copy link
Copy Markdown

@BenWoodford @Nakroma In pyloopenergy we're using version 0.5.6 because the server we're talking to is socket.IO version 0.9

Don't know if the the same issue - and if so whether it's practical to port it back.

@JasXSL

JasXSL commented Feb 20, 2018

Copy link
Copy Markdown

@Nakroma I believe there's an issue with your fork where the connect/reconnect events are never raised. I added some further debugging and it seems like I'm only receiving packets of type 3 & 4

Edit: disconnect is actually being raised, just not connect/reconnect.

juhhov pushed a commit to PelionIoT/socketIO-client that referenced this pull request Aug 1, 2018
juhhov pushed a commit to PelionIoT/socketIO-client that referenced this pull request Aug 1, 2018
juhhov pushed a commit to PelionIoT/socketIO-client that referenced this pull request Aug 2, 2018
juhhov pushed a commit to PelionIoT/socketIO-client that referenced this pull request Aug 2, 2018
@nkruzan

nkruzan commented Feb 21, 2023

Copy link
Copy Markdown

this fix my issue connecting to cncjs. thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Socket.IO v2 support