Skip to content

Commit

Permalink
added PR invisibleroads#158 by oguzhanogreden
Browse files Browse the repository at this point in the history
  • Loading branch information
Nakroma authored and Juho Hovila committed Aug 1, 2018
1 parent daa5939 commit 48c2503
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions socketIO_client/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,14 @@ def _make_packet_prefix(packet):


def _read_packet_length(content, content_index):
while get_byte(content, content_index) != 0:
while content.decode()[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 = content.decode()[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:
while content.decode()[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 48c2503

Please sign in to comment.