Skip to content

Commit 43a1f30

Browse files
committed
Add subscription event (placeholder)
1 parent 5919290 commit 43a1f30

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/App.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ struct TemplatedApp {
241241
MoveOnlyFunction<void(WebSocket<SSL, true, UserData> *)> drain = nullptr;
242242
MoveOnlyFunction<void(WebSocket<SSL, true, UserData> *, std::string_view)> ping = nullptr;
243243
MoveOnlyFunction<void(WebSocket<SSL, true, UserData> *, std::string_view)> pong = nullptr;
244+
MoveOnlyFunction<void(WebSocket<SSL, true, UserData> *, std::string_view, int, int)> subscription = nullptr;
244245
MoveOnlyFunction<void(WebSocket<SSL, true, UserData> *, int, std::string_view)> close = nullptr;
245246
};
246247

@@ -347,6 +348,7 @@ struct TemplatedApp {
347348
webSocketContext->getExt()->openHandler = std::move(behavior.open);
348349
webSocketContext->getExt()->messageHandler = std::move(behavior.message);
349350
webSocketContext->getExt()->drainHandler = std::move(behavior.drain);
351+
webSocketContext->getExt()->subscriptionHandler = std::move(behavior.subscription);
350352
webSocketContext->getExt()->closeHandler = std::move([closeHandler = std::move(behavior.close)](WebSocket<SSL, true, UserData> *ws, int code, std::string_view message) mutable {
351353
if (closeHandler) {
352354
closeHandler(ws, code, message);

src/WebSocketContextData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ struct WebSocketContextData {
6060
MoveOnlyFunction<void(WebSocket<SSL, true, USERDATA> *)> openHandler = nullptr;
6161
MoveOnlyFunction<void(WebSocket<SSL, true, USERDATA> *, std::string_view, OpCode)> messageHandler = nullptr;
6262
MoveOnlyFunction<void(WebSocket<SSL, true, USERDATA> *)> drainHandler = nullptr;
63+
MoveOnlyFunction<void(WebSocket<SSL, true, USERDATA> *, std::string_view, int, int)> subscriptionHandler = nullptr;
6364
MoveOnlyFunction<void(WebSocket<SSL, true, USERDATA> *, int, std::string_view)> closeHandler = nullptr;
64-
/* Todo: these should take message also; breaking change for v0.18 */
6565
MoveOnlyFunction<void(WebSocket<SSL, true, USERDATA> *, std::string_view)> pingHandler = nullptr;
6666
MoveOnlyFunction<void(WebSocket<SSL, true, USERDATA> *, std::string_view)> pongHandler = nullptr;
6767

0 commit comments

Comments
 (0)