pull/39/head
Ciro 2022-11-30 22:16:05 -03:00
rodzic dac2308f5c
commit 2dd71241be
1 zmienionych plików z 3 dodań i 7 usunięć

Wyświetl plik

@ -1,6 +1,7 @@
from socketify import App, AppOptions, OpCode, CompressOptions from socketify import App, AppOptions, OpCode, CompressOptions
remaining_clients = 16 remaining_clients = 16
app = App(websocket_factory_max_itens=1_500_000)
def ws_open(ws): def ws_open(ws):
@ -11,23 +12,18 @@ def ws_open(ws):
print("All clients connected") print("All clients connected")
print('Starting benchmark by sending "ready" message') print('Starting benchmark by sending "ready" message')
ws.publish("room", "ready", OpCode.TEXT) app.publish("room", "ready", OpCode.TEXT)
# publish will send to everyone except it self so send to it self too
ws.send("ready", OpCode.TEXT)
def ws_message(ws, message, opcode): def ws_message(ws, message, opcode):
# publish will send to everyone except it self so send to it self too # publish will send to everyone except it self so send to it self too
ws.publish("room", message, opcode) app.publish("room", message, opcode)
ws.send(message, opcode)
def ws_close(ws, close, message): def ws_close(ws, close, message):
global remaining_clients global remaining_clients
remaining_clients = remaining_clients + 1 remaining_clients = remaining_clients + 1
app = App(websocket_factory_max_itens=1_500_000)
app.ws( app.ws(
"/*", "/*",
{ {