Skip to content

Commit d96d5a2

Browse files
committed
2 parents 8bd27c2 + b9863e4 commit d96d5a2

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<p>Linux/Mac <img src="https://travis-ci.org/smasherprog/websocket_lite.svg?branch=master"/><p>
55
<p>Windows <img src="https://ci.appveyor.com/api/projects/status/kqa94n7p8se05vi9/branch/master?svg=true"/><p>
66
<p>Websocket <a href="https://tools.ietf.org/html/rfc6455">rfc6455</a> Compliant. Working on rfc 7692 -- which supports compression<p>
7-
<p>This library is intended to be a fully compliant websocket implementation <a href="http://htmlpreview.github.io/?https://github.com/smasherprog/websocket_lite/blob/master/Test/autobahn/index.html">Autobahn complete </a> (minus rfc 7692--in progress), but with a few design goals:
7+
<p>This library is intended to be a fully compliant websocket implementation <a href="http://htmlpreview.github.io/?https://github.com/smasherprog/Projects_Setup/blob/master/websocket_lite/index.html">Autobahn complete </a> (minus rfc 7692--in progress), but with a few design goals:
88

99
<ul>
1010
<li>
@@ -42,20 +42,29 @@ WIndows: vcpkg install openssl zlib
4242
https://github.com/smasherprog/websocket_lite/blob/master/Test/main.cpp
4343

4444
```c++
45-
auto listener = SL::WS_LITE::CreateContext(SL::WS_LITE::ThreadCount(1))
46-
.CreateListener(SL::WS_LITE::PortNumber(3000))
47-
.onConnection([&](const std::shared_ptr<SL::WS_LITE::IWSocket>& socket, const std::unordered_map<std::string, std::string>& header) {
48-
49-
}).onMessage([&](const std::shared_ptr<SL::WS_LITE::IWSocket>& socket, const SL::WS_LITE::WSMessage& message) {
5045

51-
}).listen();
46+
SL::WS_LITE::PortNumber port(3002);
47+
auto listener =
48+
SL::WS_LITE::CreateContext(SL::WS_LITE::ThreadCount(1))
49+
->NoTLS()
50+
->CreateListener(port)
51+
->onConnection([&](const std::shared_ptr<SL::WS_LITE::IWSocket> &socket, const std::unordered_map<std::string, std::string> &header) {
52+
53+
})
54+
->onMessage([&](const std::shared_ptr<SL::WS_LITE::IWSocket> &socket, const SL::WS_LITE::WSMessage &message) {
55+
56+
})->listen();
57+
listener->set_ReadTimeout(std::chrono::seconds(100));
58+
listener->set_WriteTimeout(std::chrono::seconds(100));
5259

53-
auto clientctx = SL::WS_LITE::CreateContext(SL::WS_LITE::ThreadCount(1))
54-
.CreateClient()
55-
.onConnection([&](const std::shared_ptr<SL::WS_LITE::IWSocket>& socket, const std::unordered_map<std::string, std::string>& header) {
56-
57-
}).onDisconnection([&](const std::shared_ptr<SL::WS_LITE::IWSocket>& socket, unsigned short code, const std::string& msg) {
60+
auto clientctx =
61+
SL::WS_LITE::CreateContext(SL::WS_LITE::ThreadCount(1))
62+
->NoTLS()
63+
->CreateClient()
64+
->onConnection([&](const std::shared_ptr<SL::WS_LITE::IWSocket> &socket, const std::unordered_map<std::string, std::string> &header) {
5865

59-
}).connect("localhost", SL::WS_LITE::PortNumber(3000));
66+
})
67+
->onDisconnection([&](const std::shared_ptr<SL::WS_LITE::IWSocket> &socket, unsigned short code, const std::string &msg) {
68+
})->connect("localhost", port);
6069

6170
```

0 commit comments

Comments
 (0)