From 88ada3bc05ea247b6c8a24db49ebfdd268c17f4d Mon Sep 17 00:00:00 2001 From: V-Sanjana Date: Thu, 13 Apr 2023 15:18:31 +0530 Subject: Add Server-Sent-Event support Server-Sent-Event is a standard describing how servers can initiate data transmission towards clients once an initial client connection has been established. Unlike websockets (which are bidirectional), Server-Sent-Events(SSE) are unidirectional and commonly used to send message updates or continuous data streams to a browser client. This is base patch for adding Server-Sent-Events routing support to bmcweb. Redfish EventService SSE style subscription uses SSE route for sending the Events/MetricReports to client which establishes the connection. Tested this patch with along with EventService SSE support patches and verified the functionalty on browser. Tested: - Tested using follow-up patches on top which adds support for Redfish EventService SSE style subscription and observed events are getting sent periodically. - Created SSE subscription from the browser by visiting https:///redfish/v1/EventService/SSE Change-Id: I36956565cbba30c2007852c9471f477f6d1736e9 Signed-off-by: AppaRao Puli Signed-off-by: P Dheeraj Srujan Kumar Signed-off-by: V-Sanjana --- http/http_connection.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'http/http_connection.hpp') diff --git a/http/http_connection.hpp b/http/http_connection.hpp index 7b66ac851b..1b85c6b7b4 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -244,10 +244,11 @@ class Connection : self->completeRequest(thisRes); }); - if (thisReq.isUpgrade() && - boost::iequals( - thisReq.getHeaderValue(boost::beast::http::field::upgrade), - "websocket")) + if ((thisReq.isUpgrade() && + boost::iequals( + thisReq.getHeaderValue(boost::beast::http::field::upgrade), + "websocket")) || + (Handler::isSseRoute(*req))) { asyncResp->res.setCompleteRequestHandler( [self(shared_from_this())](crow::Response& thisRes) { -- cgit v1.2.3