Skip to content
zaphoyd edited this page Nov 26, 2011 · 6 revisions

This article refers to the upcoming v0.2.0 release.


class uri represents a websocket URI. It can be used to parse a URI into individual components or build a URI string from individual components. Once constructed a URI cannot be changed. The URI constructor will throw a uri_exception if the given parameters do not constitute a valid WebSocket URI.

Types & Constants

Name Description
DEFAULT_PORT Default WebSocket port (80)
DEFAULT_SECURE_PORT Default secure WebSocket port (443)

Member functions

Function Description
uri(const std::string& uri) Construct a URI from a string
uri(bool secure, const std::string& host, uint16_t port, const std::string& resource) Construct a URI from individual parts.
uri(bool secure, const std::string& host, const std::string& port, const std::string& resource) Construct a URI from individual parts (port as a string).
bool get_secure() const Return whether or not the URI scheme indicates a secure connection (ie wss vs ws)
std::string get_host() const Returns the host name component of the URI (without a port)
uint16_t get_port() const Returns the port component of the URI
std::string get_resource() const Returns the full resource component of the URI
std::string str() const Returns a string with the full URI

Thread safety

URI objects are immutable after construction
Distinct Objects: safe
Shared Objects: safe

Requirements

websocketpp/uri.hpp
boost_regex