-
Notifications
You must be signed in to change notification settings - Fork 205
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
Error: string index out of range error #129
Comments
The fix to this I think is for zero byte packets and the same issue is also in SocketIo in
I have added the extra line in the following in my own version as this approach is terribly CPU dragging and I have other threads to run
I actually discovered my problem was sending boolean values from my socket client in node.js which are not happily dealt with. |
@markw63 When the opcode sent by server is 8, |
Agreed . If you force it to loop on zero length then eventually it gracefully disconnects and reconnects. Trying to see why my node.js server is socketing this back. It happens just after one of my other clients sends its first message back to server via server and then this client receives it. Then fails. But only in certain circumstances around reconnecting. Something to do with Websocket not reconnecting gracefully? Is websocket 0x8 a close? |
@markw63 WebSocket Protocol :https://tools.ietf.org/html/rfc6455#page-36 |
I hit the same problem. Why was this issue closed if a close frame (0x8) is a valid WebSocket message? Shouldn’t this be handled properly by the library? It could either handle the empty string (feels more like a hack to me), or use |
In agreement with the previous comments. Currently I have code where I end up with a disconnect and reconnect - this only occurs where a client disconnects from a room, then reconnects to a room where another client is sending socket messages. The first message back to the reconnecting client tells it to close. |
It happens to me when my Node.js server is closed (during a deployment). It calls |
At line 20 - add PacketError to the import |
Thanks for the code. The questions I have now are:
|
Agree - the underlying websockets library does a self.send.close() on receipt of that 0x8. Then returns a null string "" as data to the calling function. Which automatically will crash the current code. So it needs fixing |
Do we have any luck with this issue? |
Bump. Can someone please fix this issue or expand on why it can't be fixed as described above? Thanks!! |
I dont know is our repo still alive or not |
+1 |
Payload section of engine.io protocol specify packet format when XHR2 is not available. if the server communicating under this protocol _read_packet_length of pharsers.py does not correctly detect the length. i was able to fix the issue by adding extra length detection method and, # extra function to support XHR1 style protocol
def _read_packet_length2(content, content_index):
packet_length_string = ''
#print content,content_index
while get_byte(content, content_index) != ord(':'):
#print content,content_index
byte = get_byte(content, content_index)
packet_length_string += chr(byte)
#print packet_length_string
content_index += 1
content_index += 1
return content_index, int(packet_length_string) calling it from phasers.py (note _read_packet_length2) def decode_engineIO_content(content):
content_index = 0
content_length = len(content)
while content_index < content_length:
try:
content_index, packet_length = _read_packet_length2(
content, content_index)
except IndexError:
break
content_index, packet_text = _read_packet_text(
content, content_index, packet_length)
engineIO_packet_type, engineIO_packet_data = parse_packet_text(
packet_text)
yield engineIO_packet_type, engineIO_packet_data and it works with my node.js socket.io now. |
You sir @mihindupaul are my hero. It solved all my issues while connecting to my node.js server. Truly, thanks a lot! |
I tried to use socketIO_client to recv data from my server.And it raise "string index out of range error" when the opcode is 8.The opcode is definded in websocket protocol.
Error message:
The text was updated successfully, but these errors were encountered: