Add masking key to close. Fixes #21.
This commit is contained in:
+2
-2
@@ -353,8 +353,8 @@ class _RealWebSocket : public easywsclient::WebSocket
|
|||||||
void close() {
|
void close() {
|
||||||
if(readyState == CLOSING || readyState == CLOSED) { return; }
|
if(readyState == CLOSING || readyState == CLOSED) { return; }
|
||||||
readyState = CLOSING;
|
readyState = CLOSING;
|
||||||
uint8_t closeFrame[2] = {0x88, 0x00};
|
uint8_t closeFrame[6] = {0x88, 0x80, 0x00, 0x00, 0x00, 0x00}; // last 4 bytes are a masking key
|
||||||
std::vector<uint8_t> header(closeFrame, closeFrame+2);
|
std::vector<uint8_t> header(closeFrame, closeFrame+6);
|
||||||
txbuf.insert(txbuf.end(), header.begin(), header.end());
|
txbuf.insert(txbuf.end(), header.begin(), header.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user