-
Notifications
You must be signed in to change notification settings - Fork 0
Client API
Include websocketpp.hpp
Create a websocketpp::client_ptr
initialized to a new websocketpp::client
object.
The client constructor will need:
- A
boost::asio::io_service
object to use to manage its async operations - An object that implements the
websocketpp::connection_handler
interface to provide callback functions (See Handler API)
After construction, the client object will be in the initialization state. At this time you can set up client configuration options either via calling individual set options commands or by loading them in a batch from a configuration file.
Opening a new connection:
Per the websocket spec, a client can only have one connection in the connecting state at a time. Client method new_session()
will create a new session and return a shared pointer to it. After this point new_session()
will throw an exception if you attempt to call it again before the most recently created session has either successfully connected or failed to connect.
new_session()
- call
websocketpp::client::new_session()
. This will return asession_ptr
.