Add masking key to close. Fixes #21.

This commit is contained in:
David Baird
2013-11-14 00:03:40 -07:00
parent e610b3c626
commit b21fb350b9
+2 -2
View File
@@ -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());
} }