@@ -476,41 +476,76 @@ namespace crow // NOTE: Already documented in "crow/app.h"
476476 return *this ;
477477 }
478478
479+ // / \brief Set functor that process a client request to open a WebSocket.
480+ // / The required interface is:
481+ // / void(crow::websocket::connection& conn)
482+ // /
483+ // / \param f Functor to set.
484+ // /
479485 template <typename Func>
480486 self_t & onopen (Func f)
481487 {
482488 open_handler_ = f;
483489 return *this ;
484490 }
485491
492+ // / \brief Set functor that process a client message.
493+ // / The required interface is:
494+ // / void(crow::websocket::connection& conn, const std::string& msgData, bool is_binary)
495+ // /
496+ // / \param f Functor to set.
497+ // /
486498 template <typename Func>
487499 self_t & onmessage (Func f)
488500 {
489501 message_handler_ = f;
490502 return *this ;
491503 }
492504
505+ // / \brief Set functor that process a client close.
506+ // / The required interface is:
507+ // / void(crow::websocket::connection& conn, const std::string& reason, uint16_t status_code)
508+ // /
509+ // / \param f Functor to set.
510+ // /
493511 template <typename Func>
494512 self_t & onclose (Func f)
495513 {
496514 close_handler_ = f;
497515 return *this ;
498516 }
499517
518+ // / \brief Set functor that process an error on this WebSocket.
519+ // / The required interface is:
520+ // / void(crow::websocket::connection& conn, const std::string& error_message)
521+ // /
522+ // / \param f Functor to set.
523+ // /
500524 template <typename Func>
501525 self_t & onerror (Func f)
502526 {
503527 error_handler_ = f;
504528 return *this ;
505529 }
506530
507-
531+ // / \brief Set functor that process a client request to start a WebSocket.
532+ // / The required interface is:
533+ // / const crow::request& conn, std::optional<crow::response>& response, void** userData)
534+ // /
535+ // / \param callback Functor to set.
536+ // /
508537 self_t & onaccept (std::function<void (const crow::request&, std::optional<crow::response>&, void **)>&& callback)
509538 {
510539 accept_handler_ = std::move (callback);
511540 return *this ;
512541 }
513542
543+ // / \brief Set functor that process a client request to start a WebSocket.
544+ // / The required interface is (**without response**):
545+ // / const crow::request& conn, void** userData)
546+ // /
547+ // / \param callback Functor to set.
548+ // /
514549 self_t & onaccept (std::function<bool (const crow::request&, void **)>&& callback)
515550 {
516551 onaccept ([callback](const crow::request& req, std::optional<crow::response>& res, void ** p) {
0 commit comments