File: server_send.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 (29 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import time
import socketio


class Server(socketio.Server):
    def _send_packet(self, eio_sid, pkt):
        pass

    def _send_eio_packet(self, eio_sid, eio_pkt):
        pass


def test():
    s = Server()
    start = time.time()
    count = 0
    s._handle_eio_connect('123', 'environ')
    s._handle_eio_message('123', '0')
    while True:
        s.emit('test', 'hello')
        count += 1
        if time.time() - start >= 5:
            break
    return count


if __name__ == '__main__':
    count = test()
    print('server_send:', count, 'packets received.')