Adds storage and getter for negotiated subprotocol

This commit is contained in:
Peter Thorson
2013-04-05 08:28:54 -05:00
parent 1f450fd034
commit 8c7c31362d
2 changed files with 19 additions and 2 deletions

View File

@@ -519,7 +519,20 @@ public:
* @param uri The new URI to set
*/
void set_uri(uri_ptr uri);
/////////////////////////////
// Subprotocol negotiation //
/////////////////////////////
/// Gets the negotated subprotocol
/**
* Retrieves the subprotocol that was negotiated during the handshake. This
* method is valid in the open handler and later.
*
* @return The negotiated subprotocol
*/
const std::string& get_subprotocol() const;
/////////////////////////////////////////////////////////////
// Pass-through access to the request and response objects //
/////////////////////////////////////////////////////////////
@@ -952,6 +965,7 @@ private:
request_type m_request;
response_type m_response;
uri_ptr m_uri;
std::string m_subprotocol;
const bool m_is_server;
alog_type& m_alog;

View File

@@ -316,7 +316,10 @@ void connection<config>::set_uri(uri_ptr uri) {
template <typename config>
const std::string & connection<config>::get_subprotocol() const {
return m_subprotocol;
}