summaryrefslogtreecommitdiff
path: root/http/http_connection.hpp
diff options
context:
space:
mode:
authorV-Sanjana <sanjana.v@intel.com>2023-04-13 12:48:31 +0300
committerEd Tanous <ed@tanous.net>2023-06-01 23:43:11 +0300
commit88ada3bc05ea247b6c8a24db49ebfdd268c17f4d (patch)
treef9dc4aa1415ea50a7d62c348b1118e307eb11b6a /http/http_connection.hpp
parent600af5f1ee6f3a589d5c1a7be31579ca705eef71 (diff)
downloadbmcweb-88ada3bc05ea247b6c8a24db49ebfdd268c17f4d.tar.xz
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://<BMC IP>/redfish/v1/EventService/SSE Change-Id: I36956565cbba30c2007852c9471f477f6d1736e9 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> Signed-off-by: V-Sanjana <sanjana.v@intel.com>
Diffstat (limited to 'http/http_connection.hpp')
-rw-r--r--http/http_connection.hpp9
1 files changed, 5 insertions, 4 deletions
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) {