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 a341573
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions socketIO_client/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,17 @@ def _make_packet_prefix(packet):


def _read_packet_length(content, content_index):
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)
while byte != 58: # ':'
packet_length_string += chr(byte)
content_index += 1
byte = get_byte(content, 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 get_byte(content, content_index) == 58: # ':'
content_index += 1
packet_text = content[content_index:content_index + packet_length]
return content_index + packet_length, packet_text

0 comments on commit a341573

Please sign in to comment.