Skip to content

Commit 228cab6

Browse files
committed
feat: client implementation
1 parent 1c82165 commit 228cab6

2 files changed

Lines changed: 75 additions & 0 deletions

File tree

include/boost/ws_proto/client.hpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com)
3+
//
4+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
//
7+
// Official repository: https://github.com/cppalliance/ws_proto
8+
//
9+
10+
#ifndef BOOST_WS_PROTO_CLIENT_HPP
11+
#define BOOST_WS_PROTO_CLIENT_HPP
12+
13+
#include <boost/ws_proto/detail/config.hpp>
14+
15+
namespace boost {
16+
namespace ws_proto {
17+
18+
enum class frame_type
19+
{
20+
ping,
21+
pong,
22+
close,
23+
cont,
24+
data
25+
};
26+
27+
/** A WebSocket client
28+
*/
29+
class client
30+
{
31+
public:
32+
/** Add an outgoing frame
33+
*/
34+
template<class ConstBufferSequence>
35+
bool
36+
write(
37+
frame_type kind,
38+
ConstBufferSequence const& payload);
39+
};
40+
41+
} // ws_proto
42+
} // boost
43+
44+
#endif

test/unit/client.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
3+
//
4+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
//
7+
// Official repository: https://github.com/cppalliance/ws_proto
8+
//
9+
10+
// Test that header file is self-contained.
11+
#include <boost/ws_proto/client.hpp>
12+
13+
#include "test_suite.hpp"
14+
15+
namespace boost {
16+
namespace ws_proto {
17+
18+
struct client_test
19+
{
20+
void
21+
run()
22+
{
23+
}
24+
};
25+
26+
TEST_SUITE(
27+
client_test,
28+
"boost.ws_proto.client");
29+
30+
} // ws_proto
31+
} // boost

0 commit comments

Comments
 (0)