mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
btest/core/suspend_processing: Add WebSocket example
Add a test/example forwarding all new_connection() events produced during `zeek -r wikipedia.trace` as my_new_connection() to a WebSocket client. This is mostly to demonstrate and verify usage of suspend_processing(), websocket_client_added(), resume_processing(), Pcap::file_done(), websocket_client_lost() and terminate() together.
This commit is contained in:
parent
dd881d9cde
commit
9e7537044f
4 changed files with 177 additions and 0 deletions
|
@ -33,8 +33,14 @@ import time
|
|||
from typing import Any, Callable, Optional, Union
|
||||
|
||||
import websockets.sync.client
|
||||
from websockets.exceptions import (
|
||||
ConnectionClosedError,
|
||||
ConnectionClosedOK,
|
||||
)
|
||||
from websockets.sync.client import ClientConnection
|
||||
|
||||
_ = ConnectionClosedOK, ConnectionClosedError
|
||||
|
||||
WS_PORT = (
|
||||
int(os.environ["WEBSOCKET_PORT"].split("/")[0])
|
||||
if "WEBSOCKET_PORT" in os.environ
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue