Ed Tanous | 40e9b92 | 2024-09-10 13:50:16 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // SPDX-FileCopyrightText: Copyright OpenBMC Authors |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 3 | #pragma once |
Ed Tanous | 41fe81c | 2024-09-02 15:08:41 -0700 | [diff] [blame] | 4 | #include "boost_formatters.hpp" |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 5 | |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 6 | #include <boost/beast/http/write.hpp> |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 7 | |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 8 | #include <memory> |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 9 | #include <string_view> |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 10 | |
| 11 | namespace crow |
| 12 | { |
| 13 | |
| 14 | namespace sse_socket |
| 15 | { |
Ed Tanous | 93cf0ac | 2024-03-28 00:35:13 -0700 | [diff] [blame] | 16 | struct Connection : public std::enable_shared_from_this<Connection> |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 17 | { |
| 18 | public: |
Ed Tanous | 6fde95f | 2023-06-01 07:33:34 -0700 | [diff] [blame] | 19 | Connection() = default; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 20 | |
| 21 | Connection(const Connection&) = delete; |
| 22 | Connection(Connection&&) = delete; |
| 23 | Connection& operator=(const Connection&) = delete; |
| 24 | Connection& operator=(const Connection&&) = delete; |
| 25 | virtual ~Connection() = default; |
| 26 | |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 27 | virtual void close(std::string_view msg = "quit") = 0; |
Ed Tanous | 6d799e1 | 2024-09-11 14:33:37 -0700 | [diff] [blame] | 28 | virtual void sendSseEvent(std::string_view id, std::string_view msg) = 0; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 29 | }; |
V-Sanjana | 88ada3b | 2023-04-13 15:18:31 +0530 | [diff] [blame] | 30 | } // namespace sse_socket |
| 31 | } // namespace crow |