xref: /openbmc/bmcweb/http/server_sent_event.hpp (revision e60300aee76b7875f5fc407acede2f05ddbdd9bc)
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors
3 #pragma once
4 #include "boost_formatters.hpp"
5 
6 #include <boost/beast/http/write.hpp>
7 
8 #include <memory>
9 #include <string_view>
10 
11 namespace crow
12 {
13 
14 namespace sse_socket
15 {
16 struct Connection : public std::enable_shared_from_this<Connection>
17 {
18   public:
19     Connection() = default;
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 
27     virtual void close(std::string_view msg = "quit") = 0;
28     virtual void sendSseEvent(std::string_view id, std::string_view msg) = 0;
29 };
30 } // namespace sse_socket
31 } // namespace crow
32