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:
Arne Welzel 2025-08-11 11:04:18 +02:00 committed by Tim Wojtulewicz
parent dd881d9cde
commit 9e7537044f
4 changed files with 177 additions and 0 deletions

View file

@ -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