Skip to content

Commit

Permalink
Fix issue for Socket.io 2.x socketio/engine.io#315.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhe Li committed Nov 12, 2017
1 parent cf19bc1 commit db2076c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions socketIO_client/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,16 @@ def _make_packet_prefix(packet):


def _read_packet_length(content, content_index):
while get_byte(content, content_index) not in [0, 1]:
decoded_content = content.decode()
while decoded_content[content_index] != ':':
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)
packet_length_string = decoded_content[0:content_index]
return content_index, int(packet_length_string)


def _read_packet_text(content, content_index, packet_length):
while get_byte(content, content_index) == 255:
decoded_content = content.decode()
while decoded_content[content_index] == ':':
content_index += 1
packet_text = content[content_index:content_index + packet_length]
return content_index + packet_length, packet_text

0 comments on commit db2076c

Please sign in to comment.