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

when connect to server,raise StopIteration #170

Closed
AmazingRaise opened this issue Oct 20, 2017 · 5 comments
Closed

when connect to server,raise StopIteration #170

AmazingRaise opened this issue Oct 20, 2017 · 5 comments

Comments

@AmazingRaise
Copy link

when connect to server, I got return

97:0{"sid":"cHjXNrXgO3JKL2rgAAAz","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}

however , socketIO-client raise StopIteration Exception.
I review the code , found funciton _read_packet_length in parsers.py, using ASCII to measure the length. That's the problem, I suppose.

@AmazingRaise
Copy link
Author

def _read_packet_length(content, content_index):
if 'sid' not in content:
raise IndexError

val = re.findall('([\d]+)[:][\d]', content)
if val:
    content_index = len(val[0]) + 1
    return content_index, int(val[0])

while get_byte(content, content_index) != 0:
    content_index += 1
content_index += 1
packet_length_string = ''
byte = get_byte(content, content_index)
while byte != 255:
    packet_length_string += str(byte)
    content_index += 1
    byte = get_byte(content, content_index)
return content_index, int(packet_length_string)

It works, but I don't know what where happen

@AmazingRaise
Copy link
Author

I found on server, the socekt.io version is 2.0.x, I think I should found the difference

@AmazingRaise
Copy link
Author

socketio/socket.io#2833
socket.io(version 2.0.x ):Merge Engine.IO and Socket.IO handshake packets; so read the packet error.Need do something to void this

@juesato
Copy link

juesato commented Oct 25, 2017

Likely relevant: #159

@AmazingRaise
Copy link
Author

https://github.com/nexus-devs/socketIO-client-2.0.3, have solve the problem

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

No branches or pull requests

2 participants