|
4 | 4 | <p>Linux/Mac <img src="https://travis-ci.org/smasherprog/websocket_lite.svg?branch=master"/><p> |
5 | 5 | <p>Windows <img src="https://ci.appveyor.com/api/projects/status/kqa94n7p8se05vi9/branch/master?svg=true"/><p> |
6 | 6 | <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: |
8 | 8 |
|
9 | 9 | <ul> |
10 | 10 | <li> |
@@ -42,20 +42,29 @@ WIndows: vcpkg install openssl zlib |
42 | 42 | https://github.com/smasherprog/websocket_lite/blob/master/Test/main.cpp |
43 | 43 |
|
44 | 44 | ```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) { |
50 | 45 |
|
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)); |
52 | 59 |
|
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) { |
58 | 65 |
|
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); |
60 | 69 |
|
61 | 70 | ``` |
0 commit comments