Skip to content

Commit

Permalink
Add masking key to close. Fixes #21.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhbaird committed Nov 14, 2013
1 parent e610b3c commit b21fb35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions easywsclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ class _RealWebSocket : public easywsclient::WebSocket
void close() {
if(readyState == CLOSING || readyState == CLOSED) { return; }
readyState = CLOSING;
uint8_t closeFrame[2] = {0x88, 0x00};
std::vector<uint8_t> header(closeFrame, closeFrame+2);
uint8_t closeFrame[6] = {0x88, 0x80, 0x00, 0x00, 0x00, 0x00}; // last 4 bytes are a masking key
std::vector<uint8_t> header(closeFrame, closeFrame+6);
txbuf.insert(txbuf.end(), header.begin(), header.end());
}

Expand Down

0 comments on commit b21fb35

Please sign in to comment.