-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to configure webhooks? #31
Comments
Not support yet, this feature will be add in two weeks. So far, lal only support HTTP API to query some server info, e.g. exist stream info.
Thank you. |
Great, the API is good, but the webhooks part is important for our use case. So do you think it will be done in two weeks? |
We want to test thoroughly your project. We are very much interested in it. |
Yeah, I suppose so, about next weekend.
All test and feedback are welcome. |
Awesome , looking forward to see this. |
Also please check , when i am sending some parameters in rtmp url, lal server strips those parameters. For example rtmp://myawesome-lal-rtmp-server:1935/app/hello?token=asdfasdf When I see logs, it removes token=asdfasdf from rtmp server. This is also very much needed and it should not be stripped or removed. |
Yeah, I strip parameters. |
For webhooks and also in webhooks for push relay and pull relay . I am using lal as server. |
Ok, I got it. |
How does it look like? Have you started implementing it. I am eagerly waiting to test it. |
I'll do it on this weekend. And I just noticed that you wanna relay push & pull. lalserver aready support static const relay push & pull by conf file relay_push and relay_pull, you can check these out see if satisfy. And also, I'll add some interface both in HTTP API and Webhook to support dynamic relay pull. Maybe you can tell me more info about your scenario. |
Yes I am testing that already - but using dynamic relay pull would be amazing .... Also don't strip parameters from strip key when using relay push and pull using config file. Waiting for your updates. I have another idea related to pull clustering via api, but i will discuss with you after wards. Its very interesting and doable. |
I've pushed some code to branch master. include:
And, I've written a demo dispatch, which can manager multi lal node as a cluster by dynamic relay pull from each other.
|
Amazing work. Just a quick note, can you add lal server address as well in all webhooks? Like hostname or ip? About "dispatch" I will try and test all those. |
The issue is in config file.
"http_notify": {
"enable": true,
"update_interval_sec": 5,
"on_update": "http://127.0.0.1:10101/on_update",
"on_pub_start": "http://127.0.0.1:10101/on_pub_start",
"on_pub_stop": "http://127.0.0.1:10101/on_sub_stop",
"on_sub_start": "http://127.0.0.1:10101/on_sub_start",
"on_sub_stop": "http://127.0.0.1:10101/on_sub_stop"
}, |
dynamic relay pull is not working. It should do 302 rtmp redirect to the server which has the stream. But it does not redirect and stream is not playable from other server which does not have stream. Two rtmp servers : localhost:19550 ffmpeg -i somevideo.mp4 -c copy -f flv rtmp://localhost:19350/live/ok
|
You can config each lal node with a different |
Ok, a config mistake, I've fixed it. |
LAL doesn't use Instead, the lal node which the client plays from will dynamically pull stream from the node which has the published stream. Compare to
Try:
|
Yes thats possible, but I need at least following more parameters for my use case, tcURL, Server IP and published stream id. I need it for querying the stream id and possibly kicking out the stream at some point in future. This is very important for me. please 👍 |
Kicking out the stream is another feature, maybe I will add it to HTTP API next week. |
Ok this works perfectly. However two issues i found.
$./bin/lalserver -c conf/lalserver.conf.json
$./bin/lalserver -c conf/node2.conf.json
$./bin/dispatch
$ffmpeg -re -i somevideo.mp4 -c copy -f flv rtmp://localhost:19350/live/ok
$ffplay rtmp://localhost:19550/live/ok Then stop all publishing and pulling. Now instead of publishing same stream key to |
I didn't see this. more details.
Fixed duration timer can not only use for report stream info, but also keep alive bwetten node and dispatch. |
The reason is that Two common methods to do it:
I'll do it next week. |
Ok got it. |
Yes that is important, otherwise in OBS usually if you disconnect and then try to reconnect, it will never be able to reconnect due to this issue. |
For different people, the cleanup timing is different, and it can even not decided by the stream server. You can clean up by yourself, and I'll add an HTTP API to cleanup the HLS file of the specific stream, as well.
For nginx is rtmp connect, I can add it to HTTP Notify. |
Yes thats correct, but there should be an option in config as well which can be enabled or disabled and with some timer, so that the server itself can remove it. Just an opinion as its already done by almost all RTMP servers.
Great and awesome. 👍 |
Did you already added on_connect web hook? |
I'll do it tomorrow. |
I've pushed some code to branch master:
These two features will solve the cluster republish/replay issue, try again. And, I've added Todo list:
|
Amazing work... Let me test this. Kudos to you for this effort. :) |
Seems like in push relay you mistyped variable. It should be urlParam instead of url when passing parameters. |
Tested, working OK.
These are the major stuff I am waiting to test. Do you think you can finish it in this weekend? I am doing lots of stress testing and different use cases. |
Fixed. |
What about hls clean up Do you think you can do it today? I need to test few cases. |
No, I can't do it today. I'd think about it, and maybe do it next weekend, but don't take it as a promise. |
Ok. no issues. Will be waiting for you update. By the way you haven't pushed the above urlParam change to master. Have you? |
My mistake, try again. |
If you can do this quickly, then i suppose, i should close this ticket and create new ones. Otherwise there are alot of features and new implementation in this ticket. What do you say?
|
These webhooks are not useful. Because if the backend denies the request on webhook, then publishing, playing should not happen. But it allows this. |
Yeah, that's the design.
|
How do the other media servers provide without blocking it for other users. I believe every rtmp connection is spawn in a new goroutine and for example on rtmp_connect or on_publish it sends webhook and waits for result - If the result is ok, it just continues otherwise it stops the user at that point. Its just I have seen it in all rtmp servers. In above design the only useful webhook is on_update. What is your take on that? |
I'm not saying that the authing client would block other clients. You can do auth stuff in webhooks, and call Every design has its focus. Lal prefers the user experience of normal scenarios and semantic clarity. |
Yes thats a good point, but it creates unnecessary traffic. If the user can be denied in the initial phase, its much better than to tell server to kick out session. But your point is also valid. What about hls cleanup API. I am getting thousands of files while testing stream. Can you provide some sort of minimal API quickly? Thank you |
HLS cleanup: You can config HLS cleanup flag(cleanup_flag) in the conf file. If you enable this, when pub session stop, lal will delete relative HLS file after kick out session: You can kick out the session by HTTP API HTTP API doc: https://pengrl.com/p/20100/ |
Tested and working perfectly good. Both kickout session and hls cleanup. Well done for awesome work. I would like to ask again, if its possible for you to wait for webhook response and then allow stream based on backend response. This is the only and only thing missing in this product for me at least. May be in a separate branch. Please :) |
Before the backend response, you wanna lal keep sending audio/video data to the client or not? |
No, audio video till there is a response. If the status code is 200 with text as '0', then allow the stream otherwise don't. |
Any updates on this? |
No, I have no time doing sync auth. Move to indefinite delay list. #37 |
Ok thank you for time till now. Closing this. |
Hi,
How do we configure webhooks like on_publish on_play etc?
Thank You
The text was updated successfully, but these errors were encountered: