mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
Add WebSocket support for exchanging events with external clients.
This exposes Broker's new WebSocket support in Zeek. To enable it, call `Broker::listen_websocket()`. Zeek will then start listening on port 9997 for incoming WebSocket connections. See the Broker documentation for a description of the message format expected over these WebSocket connections.
This commit is contained in:
parent
4b0e1063ed
commit
d99f041ac5
25 changed files with 248 additions and 26 deletions
|
@ -527,12 +527,21 @@ void Manager::ClearStores()
|
|||
handle->store.clear();
|
||||
}
|
||||
|
||||
uint16_t Manager::Listen(const string& addr, uint16_t port)
|
||||
uint16_t Manager::Listen(const string& addr, uint16_t port, BrokerProtocol type)
|
||||
{
|
||||
if ( bstate->endpoint.is_shutdown() )
|
||||
return 0;
|
||||
|
||||
bound_port = bstate->endpoint.listen(addr, port);
|
||||
switch ( type )
|
||||
{
|
||||
case BrokerProtocol::Native:
|
||||
bound_port = bstate->endpoint.listen(addr, port);
|
||||
break;
|
||||
|
||||
case BrokerProtocol::WebSocket:
|
||||
bound_port = bstate->endpoint.web_socket_listen(addr, port);
|
||||
break;
|
||||
}
|
||||
|
||||
if ( bound_port == 0 )
|
||||
Error("Failed to listen on %s:%" PRIu16, addr.empty() ? "INADDR_ANY" : addr.c_str(), port);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue