Skip to content

Commit a210701

Browse files
committed
Change something in _read_packets
I've some trouble to connect to socket.io server 2.1.1 I've made this change, and now everything works well.
1 parent 1e58add commit a210701

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

socketIO_client/parsers.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,19 @@ def _make_packet_prefix(packet):
120120
return header_digits
121121

122122

123-
def _read_packet_length(content, content_index):
124-
while get_byte(content, content_index) != 0:
125-
content_index += 1
126-
content_index += 1
123+
def _read_packet_length(content):
127124
packet_length_string = ''
128125
byte = get_byte(content, content_index)
129-
while byte != 255:
130-
packet_length_string += str(byte)
126+
while byte != 58: # ':'
127+
packet_length_string += chr(byte)
131128
content_index += 1
132129
byte = get_byte(content, content_index)
130+
content_index += 1
133131
return content_index, int(packet_length_string)
134132

135133

136134
def _read_packet_text(content, content_index, packet_length):
137-
while get_byte(content, content_index) == 255:
135+
while get_byte(content, content_index) == '0':
138136
content_index += 1
139137
packet_text = content[content_index:content_index + packet_length]
140138
return content_index + packet_length, packet_text

0 commit comments

Comments
 (0)