You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1KB

  1. /*
  2. * Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
  3. *
  4. * This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
  5. *
  6. * Use of this source code is governed by MIT license that can be found in the
  7. * LICENSE file in the root of the source tree. All contributing project authors
  8. * may be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef ZLMEDIAKIT_WEBHOOK_H
  11. #define ZLMEDIAKIT_WEBHOOK_H
  12. #include <string>
  13. #include <functional>
  14. #include "json/json.h"
  15. //支持json或urlencoded方式传输参数
  16. #define JSON_ARGS
  17. #ifdef JSON_ARGS
  18. typedef Json::Value ArgsType;
  19. #else
  20. typedef mediakit::HttpArgs ArgsType;
  21. #endif
  22. namespace Hook {
  23. //web hook回复最大超时时间
  24. extern const std::string kTimeoutSec;
  25. }//namespace Hook
  26. void installWebHook();
  27. void unInstallWebHook();
  28. /**
  29. * 触发http hook请求
  30. * @param url 请求地址
  31. * @param body 请求body
  32. * @param func 回调
  33. */
  34. void do_http_hook(const std::string &url, const ArgsType &body, const std::function<void(const Json::Value &, const std::string &)> &func = nullptr);
  35. #endif //ZLMEDIAKIT_WEBHOOK_H