File: binary_packet.py

package info (click to toggle)
python-socketio 5.12.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,140 kB
  • sloc: python: 11,460; makefile: 13; sh: 7
file content (22 lines) | stat: -rw-r--r-- 491 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import time
from socketio import packet


def test():
    p = packet.Packet(packet.EVENT, {'foo': b'bar'})
    start = time.time()
    count = 0
    while True:
        eps = p.encode()
        p = packet.Packet(encoded_packet=eps[0])
        for ep in eps[1:]:
            p.add_attachment(ep)
        count += 1
        if time.time() - start >= 5:
            break
    return count


if __name__ == '__main__':
    count = test()
    print('binary_packet:', count, 'packets processed.')