mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 11:51:57 +00:00
Modified on_close webhook.
Pass the send_bytes and recv_bytes count to the web hook.
This commit is contained in:
parent
bc93147426
commit
a95bd7d30e
3 changed files with 5 additions and 3 deletions
|
@ -82,7 +82,7 @@ int SrsHttpHooks::on_connect(string url, int client_id, string ip, SrsRequest* r
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* req)
|
void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* req, int64_t send_bytes, int64_t recv_bytes)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
@ -92,6 +92,8 @@ void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* re
|
||||||
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
|
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
|
||||||
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
|
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
|
||||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||||
|
<< __SRS_JFIELD_ORG("send_bytes", send_bytes) << __SRS_JFIELD_CONT
|
||||||
|
<< __SRS_JFIELD_ORG("recv_bytes", recv_bytes) << __SRS_JFIELD_CONT
|
||||||
<< __SRS_JFIELD_STR("app", req->app)
|
<< __SRS_JFIELD_STR("app", req->app)
|
||||||
<< __SRS_JOBJECT_END;
|
<< __SRS_JOBJECT_END;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
* @param url the api server url, to process the event.
|
* @param url the api server url, to process the event.
|
||||||
* ignore if empty.
|
* ignore if empty.
|
||||||
*/
|
*/
|
||||||
static void on_close(std::string url, int client_id, std::string ip, SrsRequest* req);
|
static void on_close(std::string url, int client_id, std::string ip, SrsRequest* req, int64_t send_bytes, int64_t recv_bytes);
|
||||||
/**
|
/**
|
||||||
* on_publish hook, when client(encoder) start to publish stream
|
* on_publish hook, when client(encoder) start to publish stream
|
||||||
* @param client_id the id of client on server.
|
* @param client_id the id of client on server.
|
||||||
|
|
|
@ -1294,7 +1294,7 @@ void SrsRtmpConn::http_hooks_on_close()
|
||||||
int connection_id = _srs_context->get_id();
|
int connection_id = _srs_context->get_id();
|
||||||
for (int i = 0; i < (int)on_close->args.size(); i++) {
|
for (int i = 0; i < (int)on_close->args.size(); i++) {
|
||||||
std::string url = on_close->args.at(i);
|
std::string url = on_close->args.at(i);
|
||||||
SrsHttpHooks::on_close(url, connection_id, ip, req);
|
SrsHttpHooks::on_close(url, connection_id, ip, req, skt->get_send_bytes(), skt->get_recv_bytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue