Add SSE filter param support
The Redfish spec require filtering of SSE entries to be supported.
This commit rearranges the code, and implements SSE sorting as well
as support for Last-Event-Id. To do this it adds a dependency on
boost circular_buffer.
Tested:
SSE connections succeed. Show filtered results.
Change-Id: I7aeb266fc40471519674c7b65cd5cc4625019e68
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/http/server_sent_event.hpp b/http/server_sent_event.hpp
index 1b644fc..cfc5dfb 100644
--- a/http/server_sent_event.hpp
+++ b/http/server_sent_event.hpp
@@ -38,9 +38,10 @@
class ConnectionImpl : public Connection
{
public:
- ConnectionImpl(Adaptor&& adaptorIn,
- std::function<void(Connection&)> openHandlerIn,
- std::function<void(Connection&)> closeHandlerIn) :
+ ConnectionImpl(
+ Adaptor&& adaptorIn,
+ std::function<void(Connection&, const Request&)> openHandlerIn,
+ std::function<void(Connection&)> closeHandlerIn) :
adaptor(std::move(adaptorIn)),
timer(static_cast<boost::asio::io_context&>(
adaptor.get_executor().context())),
@@ -67,14 +68,14 @@
adaptor.get_executor().context());
}
- void start()
+ void start(const Request& req)
{
if (!openHandler)
{
BMCWEB_LOG_CRITICAL("No open handler???");
return;
}
- openHandler(*this);
+ openHandler(*this, req);
sendSSEHeader();
}
@@ -281,7 +282,7 @@
boost::asio::steady_timer timer;
bool doingWrite = false;
- std::function<void(Connection&)> openHandler;
+ std::function<void(Connection&, const Request&)> openHandler;
std::function<void(Connection&)> closeHandler;
};
} // namespace sse_socket