Skip to content
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

stat_post_url - failing to post information #122

Open
thomasdbolt6 opened this issue Jan 4, 2023 · 1 comment
Open

stat_post_url - failing to post information #122

thomasdbolt6 opened this issue Jan 4, 2023 · 1 comment

Comments

@thomasdbolt6
Copy link

thomasdbolt6 commented Jan 4, 2023

I have a very simple webserver running as seen below:

const express = require("express");
const bodyParser = require("body-parser");

const app = express();
app.use(bodyParser.json());

let lastStats = {};

app.post("/sls/stat", (req, res) => {
	lastStats = req.body;
    console.log(req.body)
	res.sendStatus(200);
});

app.get("/sls/stat", (req, res) => res.json(lastStats));

app.listen(3000, () => console.log("Server started"));

My sls conf is as follows:

srt {                #SRT
    worker_threads  2;
    worker_connections 300;

    log_file /logs/error.log;
    log_level debug;

    stat_post_url http://192.168.1.203:3000/sls/stat;
    stat_post_interval  1;#s

    #record_hls_path_prefix /tmp/mov/sls;
    #vod  file name: /tmp/mov/sls/$listen/$domain_publisher/$app_publisher/$stream_name/vod.m3u8

    server {
        listen 1935;
        latency 100; #ms

        domain_player output;
        domain_publisher input;
        backlog 100; #accept connections at the same time
        idle_streams_timeout 60;#s -1: unlimited
        #on_event_url http://192.168.31.106:8000/sls/on_event; #?method=on_connect|on_close&role_name=&srt_url=%s
        app {
            app_player live ;
            app_publisher live ;

            #record_hls off;#on, off
            #record_hls_segment_duration 10; #unit s

            #relay {
            #    type pull;
            #    mode loop;#loop; hash;
            #    reconnect_interval 10;
            #    idle_streams_timeout -1;#s -1: unlimited
            #    upstreams 127.0.0.1:9090?streamid=live.sls.com/live 192.168.1.100:8080/?streamid=live.test.com/live;
            #}
            #relay {
            #    type push;
            #    mode all; #all; hash
            #    reconnect_interval 10;
            #    idle_streams_timeout 10;#s -1: unlimited
            #    upstreams 192.168.31.106:8080?streamid=uplive.sls.com/live ;
            #}
        }
    }
}

When SLS is launched, I receive a single successful post request with an empty body to my simple webserver. All subsequent stats requests fail, with the following error:

srt-live-server-srt-server-1  | 2023-01-04 11:34:51:380 SLS INFO: [0x7f77e40d2030]CTCPRole::close ok, m_fd=7.
srt-live-server-srt-server-1  | 2023-01-04 11:34:51:390 SLS INFO: [0x7f77e40d2030]CTCPRole::setup, create sock ok, m_fd=7.
srt-live-server-srt-server-1  | 2023-01-04 11:34:51:390 SLS INFO: [0x7f77e40d2030]CTCPRole::setup, setsockopt reused ok, m_fd=7.
srt-live-server-srt-server-1  | 2023-01-04 11:34:51:390 SLS INFO: [0x7f77e40d2030]CTCPRole::set_nonblock, set O_NONBLOCK ok, m_fd=7.
srt-live-server-srt-server-1  | 2023-01-04 11:34:51:390 SLS INFO: [0x7f77e40d2030]CTCPRole::connect, ok, m_fd=7, host=192.168.1.203, port==3000.
srt-live-server-srt-server-1  | 2023-01-04 11:34:51:390 SLS INFO: [0x7f77e40d2030]CHttpClient::write_http_header, wrong method=''.
srt-live-server-srt-server-1  | 2023-01-04 11:34:51:390 SLS INFO: [0x7f77e40d2030]CHttpClient::generate_http_request, write_get_header failed, remote_host='192.168.1.203', remote_port=3000.
srt-live-server-srt-server-1  | 2023-01-04 11:34:51:390 SLS INFO: [0x7f77e40d2030]CHttpClient::open, generate_http_request failed, remote_host='192.168.1.203', remote_port=3000.
srt-live-server-srt-server-1  | 2023-01-04 11:34:56:395 SLS INFO: [0x7f77e40d2030]CHttpClient::check_timeout, ok, url='http://192.168.1.203:3000/sls/stat', http_method='', content_len=0, m_response_content_length=-1.

Please advise, but it looks to me as though the http header is not being set in the http request.

There is no change in behaviour of the server with or without srt streams connected.

Thanks

@amaroarcast
Copy link

Hi Thomas, how are you?
I want to know if you can solve this.
I don't know how to exact stats from srt-live-server, because everything works fine but i don't have any stats of the server, streams, etc.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants