mirror of
https://github.com/zeek/zeek.git
synced 2025-10-16 21:48:21 +00:00
cluster/WebSocket: Pass X-Application-Name to dispatcher
This is going to be used to add labels to telemetry if the X-Application-Name header is set.
This commit is contained in:
parent
6a84237a95
commit
2f7d5eaf2a
2 changed files with 8 additions and 2 deletions
|
@ -138,8 +138,13 @@ std::unique_ptr<WebSocketServer> StartServer(std::unique_ptr<WebSocketEventDispa
|
|||
remoteIp = std::move(remoteIp),
|
||||
ixws = std::move(ixws)](const ix::WebSocketMessagePtr& msg) mutable {
|
||||
if ( msg->type == ix::WebSocketMessageType::Open ) {
|
||||
dispatcher->QueueForProcessing(
|
||||
WebSocketOpen{id, msg->openInfo.uri, msg->openInfo.protocol, std::move(ixws)});
|
||||
std::optional<std::string> application_name;
|
||||
auto it = msg->openInfo.headers.find("X-Application-Name");
|
||||
if ( it != msg->openInfo.headers.end() )
|
||||
application_name = it->second;
|
||||
|
||||
dispatcher->QueueForProcessing(WebSocketOpen{id, msg->openInfo.uri, msg->openInfo.protocol,
|
||||
std::move(application_name), std::move(ixws)});
|
||||
}
|
||||
else if ( msg->type == ix::WebSocketMessageType::Message ) {
|
||||
dispatcher->QueueForProcessing(WebSocketMessage{id, msg->str});
|
||||
|
|
|
@ -125,6 +125,7 @@ struct WebSocketOpen {
|
|||
std::string id;
|
||||
std::string uri;
|
||||
std::string protocol;
|
||||
std::optional<std::string> application_name;
|
||||
std::shared_ptr<WebSocketClient> wsc;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue