[mediasoup-broadcaster-demo] serverUrl for broadcaster client

I compiled the demo as listed in the documentation and also brought up a local mediasoup server (as per the mediasoup-demo documentation). I am able to connect to this local server via the browser by going to localhost:3000/?roomId=broadcaster.

However, when I run the c++ client demo app “broadcaster” I am not able to connect to it. I get the following error when the run this command:

$ SERVER_URL=https://localhost:4443/ ROOM_ID=broadcaster build/broadcaster
[DEBUG] mediasoupclient::Initialize() | mediasoupclient v3.0.8
[INFO] welcome to mediasoup broadcaster app!

[INFO] verifying that room 'broadcaster' exists...
[ERROR] unable to retrieve room info [status code:0, body:""]

I am sure I am missing something really basic here. I tried both 4443 and 3000 ports but get the same result suggesting something fundamentally wrong with the server url I am providing.

That slash after 4443 is wrong.

If the issue persist try accessing from the browser: https://localhost:4443/rooms/broadcaster.

Other than that…, you’ll need to check the HTTP traffic or check the mediasoup-demo logs.

Yes even without the slash it doesn’t work. However, when I log the URL from the main file, that works when I copy paste into the browser (its the same URL that you pointed out). Somehow the call
cpr::GetAsync(cpr::Url{ baseUrl }).get(); doesnt return a 200 code or the right response.

You’ll have to debug it a bit. Print the response logs and check what’s happening. Also check the traces with Wireshark or alike, may be a problem with the SSL certificates…

Make sure you consider the last note in the README

NOTE 1: PATH_TO_OPENSSL_HEADERS is /usr/local/opt/openssl/include if you install OpenSSL using Homebrew in OSX.

Looks like a certificate issue. Try with https://demo.mediasoup.org/ which certificates are valid.

Hmm I did try the demo server e.g. https://v3demo.mediasoup.org:4443/rooms/jbdbqa5w. Still get the same error from the c++ client, but the URL returns a valid response in the browser.

I did confirm that the PATH_TO_OPENSSL_HEADERS is valid (am on Ubuntu, they live in /usr/include/openssl and the version is 1.1.1).

Is there anything else on the client (c++ broadcaster) side I need to configure in terms of communicating to the server (apart from the url of course) ?

This is a cpr (the library used as HTTP client in the demo) usage problem. Sorry I don’t know how to help here, it just seems a SSL issue.

You may want to contact cpr people and ask how you could debug it.

I have the exact same problem with cpr::GetAsync(). It returns zero even if I give the right URL or a wrong URL!

	std::cout << "[INFO] verifying that room '" << envRoomId << "' exists..." << std::endl;
	auto r = cpr::GetAsync(cpr::Url{ baseUrl }, cpr::VerifySsl{ verifySsl }).get();

	if (r.status_code != 200)
		std::cerr << "[ERROR] unable to retrieve room info"
		          << " [status code:" << r.status_code << ", body:\"" << r.text << "\"]" << std::endl;

		return 1;

Try running it with VERIFY_SSL=false

Thank you compitembel. I also came to the same conclusion. The key insight came when I added an extra debug logging.

    auto r = cpr::GetAsync(cpr::Url{ baseUrl }, cpr::VerifySsl{ verifySsl }).get();
    std::cerr << r.error.message << std::endl;

Hey it works for me.

said@ubuntu:~/mediasoup-broadcaster-demo$ SERVER_URL=https://v3demo.mediasoup.org:4443 ROOM_ID=test build/broadcaster

[DEBUG] mediasoupclient::Initialize() | mediasoupclient v3.1.2
[INFO] welcome to mediasoup broadcaster app!

[INFO] verifying that room 'test' exists...
[INFO] found roomtest
[INFO] Broadcaster::Start()
[DEBUG] Device::Load() | got native RTP capabilities:
    "codecs": [
            "channels": 1,
            "clockRate": 8000,
            "kind": "audio",
            "mimeType": "audio/PCMU",
            "parameters": {},
            "preferredPayloadType": 0,
            "rtcpFeedback": []

i need to activate video ?