matt-42 / silicon

A high performance, middleware oriented C++14 http web framework please use matt-42/lithium instead
http://siliconframework.org
MIT License
1.72k stars 138 forks source link

Error on run time websocket broadcast #67

Open Reza-Ghz opened 6 years ago

Reza-Ghz commented 6 years ago

when i trying to run the websocket.o with this command: ./ws 8000 i get this error message:

terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_create
[1]    3759 abort (core dumped)  ./ws 8000

and some times this error:

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
[1]    3972 abort (core dumped)  ./ws 8000

i think the problem is this part of code :

  auto rclient = make_wspp_remote_client( _message * parameters(_text) );

  // The server websocket api accessible by the client.
  auto server_api = ws_api(

    // Broadcast a message to all clients.
    _broadcast * parameters(_message) = [&] (auto p) {
      for (const wspp_connection& c : users) rclient(c).message(p.message);
    }

    );