1 Star 0 Fork 1

m7s/plugin-hook

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Hook 插件

WebHook For Monibuca

插件地址

https://github.com/Monibuca/plugin-hook

插件引入

import (
    _ "m7s.live/plugin/hook/v4"
)

配置

hook:
  keepalive: 0 # 定时发送心跳请求,单位秒,默认0不开启
  retrytimes: 3 # 重试次数
  baseurl: "" # url前缀
  header: {} # 自定义HTTP请求头
  urllist: {} # url列表
  requestlist: {} # 请求列表
  extra: {} # 额外自定义传输数据

其中 urllist 是简单的地址列表,例如:

hook:
  urllist:
    "*": "http://www.example.com" # 任意时间均会发送请求
    startup: "http://www.example.com" # m7s启动时发送请求
    publish: "http://www.example.com/publish" # 发布时发送请求
    subscribe: "http://www.example.com/subscribe" # 订阅时发送请求
    streamClose: "http://www.example.com/streamClose" # 流关闭时发送请求
    keepalive: "http://www.example.com/keepalive" # 心跳时发送请求

requestlist 是需要单独配置 Method 和 header 时用到的

hook:
  requestlist:
    "*":
      method: GET
      header:
        referer: http://www.example.com
      url: "http://www.example.com"

发送请求数据

默认使用 POST 发送一个 json 数据:

{
  "stream": {
    "StartTime": "0001-01-01T00:00:00Z",
    "WaitTimeout": 10000000000,
    "PublishTimeout": 10000000000,
    "WaitCloseTimeout": 0,
    "Path": "live/test",
    "Publisher": {
      "ID": "",
      "Type": "RTMPReceiver",
      "StartTime": "2022-05-03T13:00:22.5353264+08:00",
      "Args": {},
      "StreamID": 1
    },
    "State": 1,
    "Subscribers": [
      {
        "ID": "",
        "Type": "RTSPSubscriber",
        "StartTime": "2022-05-03T13:00:23.8753554+08:00",
        "Args": {}
      }
    ],
    "Tracks": {
      "aac": {
        "Name": "aac",
        "BPS": 72480,
        "SampleRate": 44100,
        "SampleSize": 16,
        "CodecID": 10,
        "Channels": 2,
        "AVCCHead": "rwE=",
        "Profile": 2
      },
      "h264": {
        "Name": "h264",
        "BPS": 2226142,
        "SampleRate": 90000,
        "SampleSize": 0,
        "CodecID": 7,
        "SPSInfo": {
          "ProfileIdc": 66,
          "LevelIdc": 31,
          "MbWidth": 80,
          "MbHeight": 45,
          "CropLeft": 0,
          "CropRight": 0,
          "CropTop": 0,
          "CropBottom": 0,
          "Width": 1280,
          "Height": 720
        },
        "GOP": 27
      }
    },
    "AppName": "live",
    "StreamName": "test"
  },
  "extra": {},
  "event": "publish",
  "time": 1257894000
}

如果指定为 GET 方法,则不会发送 json 而是将 event 和 streamPath 加在 url 后面

MIT License Copyright (c) 2022 Monibuca Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

m7s 的 webhook插件,用于提供webhook功能 展开 收起
Go
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/m7s/plugin-hook.git
git@gitee.com:m7s/plugin-hook.git
m7s
plugin-hook
plugin-hook
v4

搜索帮助

344bd9b3 5694891 D2dac590 5694891