Ping/pong ahoy

This commit is contained in:
Alex Hultman
2020-02-29 00:18:25 +01:00
parent 95f173bff8
commit 591518b2d0
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -145,6 +145,8 @@ public:
/* Destruct user data after returning from close handler */
((UserData *) ws->getUserData())->~UserData();
});
webSocketContext->getExt()->pingHandler = std::move(behavior.ping);
webSocketContext->getExt()->pongHandler = std::move(behavior.pong);
/* Copy settings */
webSocketContext->getExt()->maxPayloadLength = behavior.maxPayloadLength;
+3
View File
@@ -36,6 +36,9 @@ struct WebSocketContextData {
fu2::unique_function<void(WebSocket<SSL, true> *, std::string_view, uWS::OpCode)> messageHandler = nullptr;
fu2::unique_function<void(WebSocket<SSL, true> *)> drainHandler = nullptr;
fu2::unique_function<void(WebSocket<SSL, true> *, int, std::string_view)> closeHandler = nullptr;
/* Todo: these should take message also; breaking change for v0.18 */
fu2::unique_function<void(WebSocket<SSL, true> *)> pingHandler = nullptr;
fu2::unique_function<void(WebSocket<SSL, true> *)> pongHandler = nullptr;
/* Settings for this context */
size_t maxPayloadLength = 0;