# WebRTC modules - detecting WebRTC request for stream that is not running

**URL:** <https://community.wowza.com/t/webrtc-modules-detecting-webrtc-request-for-stream-that-is-not-running/50084>\
**Category:** Wowza Streaming Engine\
**Created:** [November 7, 2017, 9:35pm UTC](https://community.wowza.com/t/webrtc-modules-detecting-webrtc-request-for-stream-that-is-not-running/50084 "2017-11-07T21:35:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaimee\_Blackwood](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Jaimee\_Blackwood](https://community.wowza.com/u/Jaimee_Blackwood)\
**Post date:** [November 7, 2017, 9:35pm UTC](https://community.wowza.com/t/webrtc-modules-detecting-webrtc-request-for-stream-that-is-not-running/50084/1 "2017-11-07T21:35:55Z")

</div>

My application supports clients pulling a stream from a URL. Streams are dormant (not actively connected to wowza) until the client side requests it.

I have achieved this with RTP and HTTP sessions, by creating a custom module that contains custom onRTPSessionCreate and onHTTPSessionCreate functions. I would like to do this same thing with WebRTC connections.

When I request a stream through WebRTC I see the following in the log:

- WebSocketSession.create[1308990425]
- WebRTCCommands.getOffer: STATUS\_ERROR\_STREAM\_NOT\_RUNNING: myStream
- WebSocketSession.destroy[1308990425]: source:client status:-1 description:Unknown

Neither the onRTPSessionCreate or onHTTPSessionCreate functions are reached during the above request. In the above request, the stream is not actively connected.

If I manually connect the stream before requesting the webRTC connection, onRTPSessionCreate IS reached. But that doesn’t help me – I need to find a way to interfere with execution before STATUS\_ERROR\_STREAM\_NOT\_RUNNING is logged.

I have tried the following:

```auto
protected class MyWebSocketListener extends WebSocketEventNotifyBase
{
	@Override
	public void onCreate(IWebSocketSession webSocketSession) {
	 	WMSLoggerFactory.getLogger(null).info("TEST");
	}
}

```

as well as

```auto
public class MVWebRTCExchangeSessionInfo extends HTTPWebRTCExchangeSessionInfo
{
	@Override
	protected void websocketSessionCreate(IWebSocketSession webSocketSession)
	{
		WMSLoggerFactory.getLogger(null).info("TEST");
	}
}

```

With no luck. Any advice appreciated

---

<div class="post-metadata">

**Author:** ![Jay\_Charles1](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/jay_charles1/32/514_2.png) [@Jay\_Charles1](https://community.wowza.com/u/Jay_Charles1)\
**Post date:** [November 8, 2017, 2:58pm UTC](https://community.wowza.com/t/webrtc-modules-detecting-webrtc-request-for-stream-that-is-not-running/50084/2 "2017-11-08T14:58:26Z")

</div>

In the WebRTC context you’ll need to do this in the HTTP provider you’re using to handle the websockets for SDP negotiation. You’re on the right track with the bits of code you posted, but it’s unclear how you’re implementing that code (if you’re putting it in a module and adding the module to your application, that won’t work).

There’s an example of subclassing the default http provider here: [https://www.wowza.com/docs/how-to-use-webrtc-with-wowza-streaming-engine](https://www.wowza.com/docs/how-to-use-webrtc-with-wowza-streaming-engine) (scroll down toward the bottom of the page)

Once you’ve properly implemented the HTTPProvider, you’ll be able to access your application modules through the IApplicationInstance.getModuleInstance() method.

---

<div class="post-metadata">

**Author:** ![Jaimee\_Blackwood](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@Jaimee\_Blackwood](https://community.wowza.com/u/Jaimee_Blackwood)\
**Post date:** [November 9, 2017, 11:29pm UTC](https://community.wowza.com/t/webrtc-modules-detecting-webrtc-request-for-stream-that-is-not-running/50084/3 "2017-11-09T23:29:13Z")

</div>

Thank you very much (once again!) - You’re correct that I was attempting to add the above code as a module. I have since extended HTTPWebRTCExchangeSessionInfo and added it as an HTTPProvider, and am making progress with that.

Exactly the nudge I needed! Thanks again!

---

<div class="post-metadata">

**Author:** ![Alok\_Kumar2](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Alok\_Kumar2](https://community.wowza.com/u/Alok_Kumar2)\
**Post date:** [September 19, 2020, 8:00am UTC](https://community.wowza.com/t/webrtc-modules-detecting-webrtc-request-for-stream-that-is-not-running/50084/4 "2020-09-19T08:00:41Z")

</div>

Hi @Jaimee_Blackwood, were you able to build the solution for WebRTC workflow ? I have the exact same use case.
