Skip to content

Commit

Permalink
Change something in _read_packets
Browse files Browse the repository at this point in the history
I've some trouble to connect to socket.io server 2.1.1
I've made this change, and now everything works well.
  • Loading branch information
edelangh committed Oct 21, 2018
1 parent 1e58add commit a210701
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions socketIO_client/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,19 @@ def _make_packet_prefix(packet):
return header_digits


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


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

0 comments on commit a210701

Please sign in to comment.