Host HTTP and WS on the same port (#414)

* Quick hack to host HTTP and WS on the same port #373

* Quick hack to host HTTP and WS on the same port #373 - simplify code

* ran clang-format

Co-authored-by: En Shih <seanstone5923@gmail.com>
Co-authored-by: The Artful Bodger <TheArtfulBodger@users.noreply.github.com>
This commit is contained in:
TheArtfulBodger
2022-11-06 01:53:11 +00:00
committed by GitHub
parent 472cf68c31
commit b0fd119d14
10 changed files with 127 additions and 95 deletions

View File

@ -170,7 +170,8 @@ namespace ix
// Server
WebSocketInitResult WebSocketTransport::connectToSocket(std::unique_ptr<Socket> socket,
int timeoutSecs,
bool enablePerMessageDeflate)
bool enablePerMessageDeflate,
HttpRequestPtr request)
{
std::lock_guard<std::mutex> lock(_socketMutex);
@ -187,7 +188,8 @@ namespace ix
_perMessageDeflateOptions,
_enablePerMessageDeflate);
auto result = webSocketHandshake.serverHandshake(timeoutSecs, enablePerMessageDeflate);
auto result =
webSocketHandshake.serverHandshake(timeoutSecs, enablePerMessageDeflate, request);
if (result.success)
{
setReadyState(ReadyState::OPEN);