# How to query WebRTC published stream names?

**URL:** <https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735>\
**Category:** Wowza Streaming Engine\
**Tags:** webrtc\
**Created:** [August 20, 2020, 7:57am UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735 "2020-08-20T07:57:29Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nguyen\_Ha](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@Nguyen\_Ha](https://community.wowza.com/u/Nguyen_Ha)\
**Post date:** [August 20, 2020, 7:57am UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/1 "2020-08-20T07:57:29Z")

</div>

I see an option to select the feature “Query Published Stream Names” on the newest WebRTC configuration panel. Really interesting, but can you show me how to do that?

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [August 20, 2020, 7:24pm UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/2 "2020-08-20T19:24:47Z")

</div>

Thanks for asking @Nguyen Ha as that may be something a lot of others wonder about at well.

The query check box on engine manager allows you to send the queryAll message over the websocket to an application.

Here is an example from this doc: [https://www.wowza.com/docs/manage-webrtc-sessions-in-wowza-streaming-engine#get-webrtc-session-information](https://www.wowza.com/docs/manage-webrtc-sessions-in-wowza-streaming-engine#get-webrtc-session-information)

```auto
List<RTPSession> getWebRTCSessions()
List<RTPSession> getWebRTCSessions(String streamName)
int getWebRTCSessionCount()
int getWebRTCSessionCount(String streamName)
Map<String, Integer> getWebRTCSessionCountsByName()

```

Those methods are an example of what the internal application uses to gather information to return to clients form the queryAll command. There are more that can be found at the link I shared. Hope that helps!

---

<div class="post-metadata">

**Author:** ![Nguyen\_Ha](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@Nguyen\_Ha](https://community.wowza.com/u/Nguyen_Ha)\
**Post date:** [August 21, 2020, 3:53am UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/3 "2020-08-21T03:53:37Z")

</div>

Thanks for your quick answer, @Rose Power-Wowza Community Manager. I’m going to make a test right now

---

<div class="post-metadata">

**Author:** ![Daniel\_Rossi](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@Daniel\_Rossi](https://community.wowza.com/u/Daniel_Rossi)\
**Post date:** [August 21, 2020, 11:06am UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/4 "2020-08-21T11:06:56Z")

</div>

I’ve got a similar requirement but to notify websocket clients when a webrtc publish begins. Not sure if its ready to subscribe within onRTPSessionCreate. I have to notify clients to start subscribing to a new webrtc publish within a particular room.

[http://community.wowza.com/community/questions/57679/access-websocket-httpprovider-from-module-within-o.html](http://community.wowza.com/community/questions/57679/access-websocket-httpprovider-from-module-within-o.html)

---

<div class="post-metadata">

**Author:** ![Daniel\_Rossi](https://avatars.discourse-cdn.com/v4/letter/d/e95f7d/32.png) [@Daniel\_Rossi](https://community.wowza.com/u/Daniel_Rossi)\
**Post date:** [August 21, 2020, 11:09am UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/5 "2020-08-21T11:09:21Z")

</div>

The available streams is the “getAvailableStreams” command. Im trying to prevent having to poll this too often and notify clients from the server instead when a webrtc session has started / stopped.

---

<div class="post-metadata">

**Author:** ![Nguyen\_Ha](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@Nguyen\_Ha](https://community.wowza.com/u/Nguyen_Ha)\
**Post date:** [August 21, 2020, 4:46am UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/6 "2020-08-21T04:46:41Z")

</div>

It seems like I sent a wrong format message

```auto
@ 11:39:35 AM [SENT]: {"command":"queryAll","direction":"publish","applicationName":"live"}

@ 11:39:35 AM [RECEIVED]: {"status":200,"statusDescription":"OK","direction":"unknown","command":"unknown","streamInfo":{"applicationName":"_defapp_/_definst_","streamName":"null","sessionId":"[empty]"}} 

```

Can you provide an example of the queryAll message?

---

<div class="post-metadata">

**Author:** ![Nguyen\_Ha](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@Nguyen\_Ha](https://community.wowza.com/u/Nguyen_Ha)\
**Post date:** [August 29, 2020, 4:27am UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/7 "2020-08-29T04:27:55Z")

</div>

@Rose Power-Wowza Community Manager Could you provive an example of the queryAll message over the websocket to an application ? I tried to create a JSON message as below and it didn’t work. It seems to be in wrong prototype

```auto
{"command":"queryAll","direction":"publish","applicationName":"live"} 

```

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [August 31, 2020, 4:06pm UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/8 "2020-08-31T16:06:27Z")

</div>

Let me check with the engineers to see if they have an example.

---

<div class="post-metadata">

**Author:** ![Nguyen\_Ha](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@Nguyen\_Ha](https://community.wowza.com/u/Nguyen_Ha)\
**Post date:** [September 1, 2020, 4:57am UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/9 "2020-09-01T04:57:55Z")

</div>

I’m counting on you

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [September 1, 2020, 5:11pm UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/10 "2020-09-01T17:11:51Z")

</div>

So, I checked with an engineer @Nguyen Ha and for the first question, there’s several ways to query wse on what streams are currently published:

1. the built-in HTTPProviders, particularly connectioncounts would have the name of the incoming streams
2. the rest api endpoint: `curl -X GET --header 'Accept:application/json; charset=utf-8' ``[http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_](http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/instances/_definst_)`
3. java api: [https://www.wowza.com/docs/how-to-use-imediastreamactionnotify3-interface-to-listen-for-rtmp-stream-events-includes-codec-info](https://www.wowza.com/docs/how-to-use-imediastreamactionnotify3-interface-to-listen-for-rtmp-stream-events-includes-codec-info)

A webRTC stream is just like any other incoming stream; if you are specifically looking for webrtc streams only, I believe you can customize a java api so that you can query a stream object and check if it is a webRTC stream.

That’s what I provided to you the first time in this thread, the java methods calls to query only webRTC streams. Something else with webRTC that’s specific to it, is that we do respond to queries from the browser, which is I think what you are asking.

that’s what the following application property corresponds to:

```auto
            <EnableQuery>false</EnableQuery>

```

Make sure that property in the app is enabled, then the JS script that had this call had this:

```auto
    function sendPlayGetAvailableStreams()
    {
        console.log("sendPlayGetAvailableStreams: "+JSON.stringify(streamInfo));
        wsConnection.send('{"direction":"play", "command":"getAvailableStreams", "streamInfo":'+JSON.stringify(streamInfo)+', "userData":'+JSON.stringify(userData)+'}');
    }

```

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [September 1, 2020, 5:15pm UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/11 "2020-09-01T17:15:26Z")

</div>

When this is invoked, the app only logs the available streams though; if you are looking to receive that information from the server to the browser client, you still have to extend a module in order for Streaming Engine to send that info back to the browser.

We just don’t have an example to show you how to do that-it’s custom work on your end. Sorry about that, that’s all I have for you, but hope it helped a little bit.

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [September 1, 2020, 5:18pm UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/12 "2020-09-01T17:18:20Z")

</div>

The functionality is there though in Engine. We try to be very clear that our webrtc option has a lot of features that will need to be configured yourself as we don’t offer a webrtc SDK or out of the box sample code for all scenarios. You can try and post in Hire A Consultant if you’d like for any custom work you may need. I hope you get what you need for your use case though.

---

<div class="post-metadata">

**Author:** ![Nguyen\_Ha](https://avatars.discourse-cdn.com/v4/letter/n/97f17d/32.png) [@Nguyen\_Ha](https://community.wowza.com/u/Nguyen_Ha)\
**Post date:** [September 8, 2020, 3:56am UTC](https://community.wowza.com/t/how-to-query-webrtc-published-stream-names/55735/13 "2020-09-08T03:56:16Z")

</div>

Thank you @Rose Power-Wowza Community Manager, I appreciate your supporting.
