-
-
Notifications
You must be signed in to change notification settings - Fork 253
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
- axmol version: release/2.x
- devices test on: android, win32
- developing environments
- NDK version: r23c
- Xcode version: 14.2+
- Visual Studio:
- VS version: 2022 (17.9+)
- MSVC version: 19.39+
- Windows SDK version: 10.0.22621.0+
- cmake version:
Steps to Reproduce:
I am using wss node package for my server side and on the close function of the WebSocket I get an error of
RangeError: Invalid WebSocket frame: invalid status code 59395
I did abit of research and discovered on the axmol websocket close method Here
_closeCode is a uint16_t, but WebSocket close codes MUST be sent in network byte order (big-endian).
Here is the modification that works
uint16_t codeNet = htons(_closeCode);
std::vector<char> closeData(sizeof(codeNet) + reason.size());
memcpy(closeData.data(), &codeNet, sizeof(codeNet));
if (!reason.empty())
{
memcpy(closeData.data() + sizeof(codeNet), reason.data(), reason.size());
}
WebSocketProtocol::sendFrame(*this, closeData.data(), closeData.size(), ws::detail::opcode::close);
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working