BVB Source Codes

uWebSockets Show beast.cpp Source code

Return Download uWebSockets: download beast.cpp Source code - Download uWebSockets Source code - Type:.cpp
  1. //
  2. // Copyright (c) 2013-2017 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.  
  8. #include "websocket_async_echo_server.hpp"
  9. #include <boost/asio/io_service.hpp>
  10. #include <boost/asio/signal_set.hpp>
  11. #include <iostream>
  12.  
  13. /// Block until SIGINT or SIGTERM is received.
  14. void
  15. sig_wait()
  16. {
  17.     boost::asio::io_service ios;
  18.     boost::asio::signal_set signals(
  19.         ios, SIGINT, SIGTERM);
  20.     signals.async_wait(
  21.         [&](boost::system::error_code const&, int)
  22.         {
  23.         });
  24.     ios.run();
  25. }
  26.  
  27. int main()
  28. {
  29.     using namespace beast::websocket;
  30.     using endpoint_type = boost::asio::ip::tcp::endpoint;
  31.     using address_type = boost::asio::ip::address;
  32.  
  33.     beast::error_code ec;
  34.  
  35.     permessage_deflate pmd;
  36.     pmd.client_enable = false;
  37.     pmd.server_enable = false;
  38.     pmd.compLevel = 3;
  39.  
  40.     websocket::async_echo_server s1{&std::cout, 1};
  41.     s1.set_option(read_message_max{64 * 1024 * 1024});
  42.     s1.set_option(auto_fragment{false});
  43.     s1.set_option(pmd);
  44.     s1.open(endpoint_type{
  45.         address_type::from_string("0.0.0.0"), 3000 }, ec);
  46.  
  47.     sig_wait();
  48. }
  49.  
downloadbeast.cpp Source code - Download uWebSockets Source code
Related Source Codes/Software:
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11

 Back to top