V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 1 | #pragma once |
Ed Tanous | 41fe81c | 2024-09-02 15:08:41 -0700 | [diff] [blame^] | 2 | #include "boost_formatters.hpp" |
Ed Tanous | b289614 | 2024-01-31 15:25:47 -0800 | [diff] [blame] | 3 | #include "http_body.hpp" |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 4 | #include "http_request.hpp" |
| 5 | #include "http_response.hpp" |
| 6 | |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 7 | #include <boost/asio/buffer.hpp> |
| 8 | #include <boost/asio/steady_timer.hpp> |
| 9 | #include <boost/beast/core/multi_buffer.hpp> |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 10 | #include <boost/beast/websocket.hpp> |
| 11 | |
| 12 | #include <array> |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 13 | #include <cstddef> |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 14 | #include <functional> |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 15 | #include <optional> |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 16 | |
| 17 | namespace crow |
| 18 | { |
| 19 | |
| 20 | namespace sse_socket |
| 21 | { |
Ed Tanous | 93cf0ac | 2024-03-28 00:35:13 -0700 | [diff] [blame] | 22 | struct Connection : public std::enable_shared_from_this<Connection> |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 23 | { |
| 24 | public: |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 25 | Connection() = default; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 26 | |
| 27 | Connection(const Connection&) = delete; |
| 28 | Connection(Connection&&) = delete; |
| 29 | Connection& operator=(const Connection&) = delete; |
| 30 | Connection& operator=(const Connection&&) = delete; |
| 31 | virtual ~Connection() = default; |
| 32 | |
| 33 | virtual boost::asio::io_context& getIoContext() = 0; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 34 | virtual void close(std::string_view msg = "quit") = 0; |
| 35 | virtual void sendEvent(std::string_view id, std::string_view msg) = 0; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | template <typename Adaptor> |
| 39 | class ConnectionImpl : public Connection |
| 40 | { |
| 41 | public: |
Ed Tanous | f80a87f | 2024-06-16 12:10:33 -0700 | [diff] [blame] | 42 | ConnectionImpl( |
| 43 | Adaptor&& adaptorIn, |
| 44 | std::function<void(Connection&, const Request&)> openHandlerIn, |
| 45 | std::function<void(Connection&)> closeHandlerIn) : |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 46 | adaptor(std::move(adaptorIn)), |
Ed Tanous | 93cf0ac | 2024-03-28 00:35:13 -0700 | [diff] [blame] | 47 | timer(static_cast<boost::asio::io_context&>( |
| 48 | adaptor.get_executor().context())), |
| 49 | openHandler(std::move(openHandlerIn)), |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 50 | closeHandler(std::move(closeHandlerIn)) |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 51 | |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 52 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 53 | BMCWEB_LOG_DEBUG("SseConnectionImpl: SSE constructor {}", logPtr(this)); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | ConnectionImpl(const ConnectionImpl&) = delete; |
| 57 | ConnectionImpl(const ConnectionImpl&&) = delete; |
| 58 | ConnectionImpl& operator=(const ConnectionImpl&) = delete; |
| 59 | ConnectionImpl& operator=(const ConnectionImpl&&) = delete; |
| 60 | |
| 61 | ~ConnectionImpl() override |
| 62 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 63 | BMCWEB_LOG_DEBUG("SSE ConnectionImpl: SSE destructor {}", logPtr(this)); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | boost::asio::io_context& getIoContext() override |
| 67 | { |
| 68 | return static_cast<boost::asio::io_context&>( |
| 69 | adaptor.get_executor().context()); |
| 70 | } |
| 71 | |
Ed Tanous | f80a87f | 2024-06-16 12:10:33 -0700 | [diff] [blame] | 72 | void start(const Request& req) |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 73 | { |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 74 | if (!openHandler) |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 75 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 76 | BMCWEB_LOG_CRITICAL("No open handler???"); |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 77 | return; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 78 | } |
Ed Tanous | f80a87f | 2024-06-16 12:10:33 -0700 | [diff] [blame] | 79 | openHandler(*this, req); |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 80 | sendSSEHeader(); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | void close(const std::string_view msg) override |
| 84 | { |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 85 | BMCWEB_LOG_DEBUG("Closing connection with reason {}", msg); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 86 | // send notification to handler for cleanup |
| 87 | if (closeHandler) |
| 88 | { |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 89 | closeHandler(*this); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 90 | } |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 91 | BMCWEB_LOG_DEBUG("Closing SSE connection {} - {}", logPtr(this), msg); |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 92 | boost::beast::get_lowest_layer(adaptor).close(); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 93 | } |
| 94 | |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 95 | void sendSSEHeader() |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 96 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 97 | BMCWEB_LOG_DEBUG("Starting SSE connection"); |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 98 | |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 99 | res.set(boost::beast::http::field::content_type, "text/event-stream"); |
Ed Tanous | 8ece0e4 | 2024-01-02 13:16:50 -0800 | [diff] [blame] | 100 | boost::beast::http::response_serializer<BodyType>& serial = |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 101 | serializer.emplace(res); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 102 | |
| 103 | boost::beast::http::async_write_header( |
Ed Tanous | 8ece0e4 | 2024-01-02 13:16:50 -0800 | [diff] [blame] | 104 | adaptor, serial, |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 105 | std::bind_front(&ConnectionImpl::sendSSEHeaderCallback, this, |
| 106 | shared_from_this())); |
| 107 | } |
| 108 | |
| 109 | void sendSSEHeaderCallback(const std::shared_ptr<Connection>& /*self*/, |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 110 | const boost::system::error_code& ec, |
| 111 | size_t /*bytesSent*/) |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 112 | { |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 113 | serializer.reset(); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 114 | if (ec) |
| 115 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 116 | BMCWEB_LOG_ERROR("Error sending header{}", ec); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 117 | close("async_write_header failed"); |
| 118 | return; |
| 119 | } |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 120 | BMCWEB_LOG_DEBUG("SSE header sent - Connection established"); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 121 | |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 122 | // SSE stream header sent, So let us setup monitor. |
| 123 | // Any read data on this stream will be error in case of SSE. |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 124 | adaptor.async_read_some(boost::asio::buffer(buffer), |
| 125 | std::bind_front(&ConnectionImpl::afterReadError, |
| 126 | this, shared_from_this())); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 127 | } |
| 128 | |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 129 | void afterReadError(const std::shared_ptr<Connection>& /*self*/, |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 130 | const boost::system::error_code& ec, size_t bytesRead) |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 131 | { |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 132 | BMCWEB_LOG_DEBUG("Read {}", bytesRead); |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 133 | if (ec == boost::asio::error::operation_aborted) |
| 134 | { |
| 135 | return; |
| 136 | } |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 137 | if (ec) |
| 138 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 139 | BMCWEB_LOG_ERROR("Read error: {}", ec); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 140 | } |
| 141 | |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 142 | close("Close SSE connection"); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | void doWrite() |
| 146 | { |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 147 | if (doingWrite) |
| 148 | { |
| 149 | return; |
| 150 | } |
| 151 | if (inputBuffer.size() == 0) |
| 152 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 153 | BMCWEB_LOG_DEBUG("inputBuffer is empty... Bailing out"); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 154 | return; |
| 155 | } |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 156 | startTimeout(); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 157 | doingWrite = true; |
| 158 | |
| 159 | adaptor.async_write_some( |
| 160 | inputBuffer.data(), |
| 161 | std::bind_front(&ConnectionImpl::doWriteCallback, this, |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 162 | shared_from_this())); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 163 | } |
| 164 | |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 165 | void doWriteCallback(const std::shared_ptr<Connection>& /*self*/, |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 166 | const boost::beast::error_code& ec, |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 167 | size_t bytesTransferred) |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 168 | { |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 169 | timer.cancel(); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 170 | doingWrite = false; |
| 171 | inputBuffer.consume(bytesTransferred); |
| 172 | |
| 173 | if (ec == boost::asio::error::eof) |
| 174 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 175 | BMCWEB_LOG_ERROR("async_write_some() SSE stream closed"); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 176 | close("SSE stream closed"); |
| 177 | return; |
| 178 | } |
| 179 | |
| 180 | if (ec) |
| 181 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 182 | BMCWEB_LOG_ERROR("async_write_some() failed: {}", ec.message()); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 183 | close("async_write_some failed"); |
| 184 | return; |
| 185 | } |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 186 | BMCWEB_LOG_DEBUG("async_write_some() bytes transferred: {}", |
| 187 | bytesTransferred); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 188 | |
| 189 | doWrite(); |
| 190 | } |
| 191 | |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 192 | void sendEvent(std::string_view id, std::string_view msg) override |
| 193 | { |
| 194 | if (msg.empty()) |
| 195 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 196 | BMCWEB_LOG_DEBUG("Empty data, bailing out."); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 197 | return; |
| 198 | } |
| 199 | |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 200 | dataFormat(id, msg); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 201 | |
| 202 | doWrite(); |
| 203 | } |
| 204 | |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 205 | void dataFormat(std::string_view id, std::string_view msg) |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 206 | { |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 207 | constexpr size_t bufferLimit = 10485760U; // 10MB |
| 208 | if (id.size() + msg.size() + inputBuffer.size() >= bufferLimit) |
| 209 | { |
| 210 | BMCWEB_LOG_ERROR("SSE Buffer overflow while waiting for client"); |
| 211 | close("Buffer overflow"); |
| 212 | return; |
| 213 | } |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 214 | std::string rawData; |
| 215 | if (!id.empty()) |
| 216 | { |
| 217 | rawData += "id: "; |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 218 | rawData.append(id); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 219 | rawData += "\n"; |
| 220 | } |
| 221 | |
| 222 | rawData += "data: "; |
| 223 | for (char character : msg) |
| 224 | { |
| 225 | rawData += character; |
| 226 | if (character == '\n') |
| 227 | { |
| 228 | rawData += "data: "; |
| 229 | } |
| 230 | } |
| 231 | rawData += "\n\n"; |
| 232 | |
Ed Tanous | 44106f3 | 2024-04-06 13:48:50 -0700 | [diff] [blame] | 233 | size_t copied = boost::asio::buffer_copy( |
| 234 | inputBuffer.prepare(rawData.size()), boost::asio::buffer(rawData)); |
| 235 | inputBuffer.commit(copied); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 236 | } |
| 237 | |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 238 | void startTimeout() |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 239 | { |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 240 | std::weak_ptr<Connection> weakSelf = weak_from_this(); |
| 241 | timer.expires_after(std::chrono::seconds(30)); |
| 242 | timer.async_wait(std::bind_front(&ConnectionImpl::onTimeoutCallback, |
| 243 | this, weak_from_this())); |
| 244 | } |
| 245 | |
| 246 | void onTimeoutCallback(const std::weak_ptr<Connection>& weakSelf, |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 247 | const boost::system::error_code& ec) |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 248 | { |
| 249 | std::shared_ptr<Connection> self = weakSelf.lock(); |
| 250 | if (!self) |
| 251 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 252 | BMCWEB_LOG_CRITICAL("{} Failed to capture connection", |
| 253 | logPtr(self.get())); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 254 | return; |
| 255 | } |
| 256 | |
| 257 | if (ec == boost::asio::error::operation_aborted) |
| 258 | { |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 259 | BMCWEB_LOG_DEBUG("Timer operation aborted"); |
Ed Tanous | 8ece0e4 | 2024-01-02 13:16:50 -0800 | [diff] [blame] | 260 | // Canceled wait means the path succeeded. |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 261 | return; |
| 262 | } |
| 263 | if (ec) |
| 264 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 265 | BMCWEB_LOG_CRITICAL("{} timer failed {}", logPtr(self.get()), ec); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 266 | } |
| 267 | |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 268 | BMCWEB_LOG_WARNING("{} Connection timed out, closing", |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 269 | logPtr(self.get())); |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 270 | |
| 271 | self->close("closing connection"); |
| 272 | } |
| 273 | |
| 274 | private: |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 275 | std::array<char, 1> buffer{}; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 276 | boost::beast::multi_buffer inputBuffer; |
| 277 | |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 278 | Adaptor adaptor; |
| 279 | |
Ed Tanous | b289614 | 2024-01-31 15:25:47 -0800 | [diff] [blame] | 280 | using BodyType = bmcweb::HttpBody; |
Ed Tanous | 8f79c5b | 2024-01-30 15:56:37 -0800 | [diff] [blame] | 281 | boost::beast::http::response<BodyType> res; |
| 282 | std::optional<boost::beast::http::response_serializer<BodyType>> serializer; |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 283 | boost::asio::steady_timer timer; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 284 | bool doingWrite = false; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 285 | |
Ed Tanous | f80a87f | 2024-06-16 12:10:33 -0700 | [diff] [blame] | 286 | std::function<void(Connection&, const Request&)> openHandler; |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 287 | std::function<void(Connection&)> closeHandler; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 288 | }; |
| 289 | } // namespace sse_socket |
| 290 | } // namespace crow |