blob: deeb1a99d987ea3a8621812146901ca8054ddabf [file] [log] [blame]
Ed Tanous40e9b922024-09-10 13:50:16 -07001// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright OpenBMC Authors
V-Sanjana88ada3b2023-04-13 15:18:31 +05303#pragma once
Ed Tanous41fe81c2024-09-02 15:08:41 -07004#include "boost_formatters.hpp"
V-Sanjana88ada3b2023-04-13 15:18:31 +05305
Ed Tanousd7857202025-01-28 15:32:26 -08006#include <boost/beast/http/write.hpp>
V-Sanjana88ada3b2023-04-13 15:18:31 +05307
Ed Tanousd7857202025-01-28 15:32:26 -08008#include <memory>
Ed Tanousd7857202025-01-28 15:32:26 -08009#include <string_view>
V-Sanjana88ada3b2023-04-13 15:18:31 +053010
11namespace crow
12{
13
14namespace sse_socket
15{
Ed Tanous93cf0ac2024-03-28 00:35:13 -070016struct Connection : public std::enable_shared_from_this<Connection>
V-Sanjana88ada3b2023-04-13 15:18:31 +053017{
18 public:
Ed Tanous6fde95f2023-06-01 07:33:34 -070019 Connection() = default;
V-Sanjana88ada3b2023-04-13 15:18:31 +053020
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-Sanjana88ada3b2023-04-13 15:18:31 +053027 virtual void close(std::string_view msg = "quit") = 0;
Ed Tanous6d799e12024-09-11 14:33:37 -070028 virtual void sendSseEvent(std::string_view id, std::string_view msg) = 0;
V-Sanjana88ada3b2023-04-13 15:18:31 +053029};
V-Sanjana88ada3b2023-04-13 15:18:31 +053030} // namespace sse_socket
31} // namespace crow