Skip to content

Commit c5d1bb5

Browse files
authored
Update README.md
1 parent 3375cfd commit c5d1bb5

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

README.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,31 @@ Latest standards: c++ 17
2828
https://github.com/smasherprog/websocket_lite/blob/master/Test/main.cpp
2929

3030
```
31-
32-
SL::WS_LITE::ThreadCount thrdcount(1);
33-
SL::WS_LITE::PortNumber port(3002);
34-
auto listener = SL::WS_LITE::WSListener::CreateListener(thrdcount, port);
31+
SL::WS_LITE::PortNumber port(3001);
32+
SL::WS_LITE::WSContext ctx(SL::WS_LITE::ThreadCount(1));
33+
auto listener = ctx.CreateListener(port);
3534
listener.onHttpUpgrade([&](const SL::WS_LITE::WSocket& socket) {
36-
SL_WS_LITE_LOG(SL::WS_LITE::Logging_Levels::INFO_log_level, "listener::onHttpUpgrade");
35+
3736
});
3837
listener.onConnection([&](const SL::WS_LITE::WSocket& socket, const std::unordered_map<std::string, std::string>& header) {
39-
SL_WS_LITE_LOG(SL::WS_LITE::Logging_Levels::INFO_log_level, "listener::onConnection");
40-
38+
4139
});
42-
listener.onDisconnection([&](const SL::WS_LITE::WSocket& socket, unsigned short code, const std::string& msg) {
43-
lastheard = std::chrono::high_resolution_clock::now();
44-
SL_WS_LITE_LOG(SL::WS_LITE::Logging_Levels::INFO_log_level, "listener::onDisconnection");
40+
listener.onMessage([&](const SL::WS_LITE::WSocket& socket, const SL::WS_LITE::WSMessage& message) {
41+
4542
});
46-
listener.startlistening();
4743
48-
auto client = SL::WS_LITE::WSClient::CreateClient(thrdcount);
44+
listener.startlistening();
45+
46+
auto client = ctx.CreateClient();
4947
client.onHttpUpgrade([&](const SL::WS_LITE::WSocket& socket) {
50-
SL_WS_LITE_LOG(SL::WS_LITE::Logging_Levels::INFO_log_level, "Client::onHttpUpgrade");
48+
5149
});
5250
client.onConnection([&](const SL::WS_LITE::WSocket& socket, const std::unordered_map<std::string, std::string>& header) {
53-
SL_WS_LITE_LOG(SL::WS_LITE::Logging_Levels::INFO_log_level, "Client::onConnection");
51+
5452
});
5553
client.onDisconnection([&](const SL::WS_LITE::WSocket& socket, unsigned short code, const std::string& msg) {
56-
SL_WS_LITE_LOG(SL::WS_LITE::Logging_Levels::INFO_log_level, "client::onDisconnection");
54+
5755
});
5856
client.connect("localhost", port);
5957
60-
6158
```

0 commit comments

Comments
 (0)