# Disconnect streams that have not had any connections for some past duration(say 2hrs)

**URL:** <https://community.wowza.com/t/disconnect-streams-that-have-not-had-any-connections-for-some-past-duration-say-2hrs/42041>\
**Category:** Wowza Streaming Engine\
**Created:** [March 2, 2014, 10:47pm UTC](https://community.wowza.com/t/disconnect-streams-that-have-not-had-any-connections-for-some-past-duration-say-2hrs/42041 "2014-03-02T22:47:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mayank\_Srivastava](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mayank\_Srivastava](https://community.wowza.com/u/Mayank_Srivastava)\
**Post date:** [March 2, 2014, 10:47pm UTC](https://community.wowza.com/t/disconnect-streams-that-have-not-had-any-connections-for-some-past-duration-say-2hrs/42041/1 "2014-03-02T22:47:11Z")

</div>

Hi,

How can a listener be implemented to disconnect all those streams that have not had any connections for some past duration say 2 hrs?

I am working with **live** streams from IP Cameras.

My requirement is to start all streams in content directory on server startup. For that I am using ServerListenerStartupStreamsMonitor.

Now, firslty, if there are some streams that have not been played for some long time, I want to stop them.

And, secondly, start them again when play has been requested. Although this can be somewhat achieved using **rtp-live** stream type ([https://www.wowza.com/docs/how-to-mediacaster-api-to-start-native-rtp-and-mpeg-ts-streams](https://www.wowza.com/docs/how-to-mediacaster-api-to-start-native-rtp-and-mpeg-ts-streams)). But the 60 sec idle time is too less time for our requirements.

Thanks,

Mayank

---

<div class="post-metadata">

**Author:** ![Mayank\_Srivastava](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mayank\_Srivastava](https://community.wowza.com/u/Mayank_Srivastava)\
**Post date:** [March 5, 2014, 7:52pm UTC](https://community.wowza.com/t/disconnect-streams-that-have-not-had-any-connections-for-some-past-duration-say-2hrs/42041/2 "2014-03-05T19:52:38Z")

</div>

Hi,

Is there an alternate way to stop streams without any connections after some timeout value specified?

Any response in this regard would be helpful.

Mayank.

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [March 8, 2014, 12:43am UTC](https://community.wowza.com/t/disconnect-streams-that-have-not-had-any-connections-for-some-past-duration-say-2hrs/42041/3 "2014-03-08T00:43:52Z")

</div>

Mayank,

In my test with StreamType “rtp-live” it only takes 10 seconds for the Wowza RTPMediaCaster to unpublish a MediaCaster stream after the RTMP playback client disconnects. So you might consider just using StreamType rtp-live if you are supporting RTMP playback clients.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [March 11, 2014, 12:29pm UTC](https://community.wowza.com/t/disconnect-streams-that-have-not-had-any-connections-for-some-past-duration-say-2hrs/42041/4 "2014-03-11T12:29:57Z")

</div>

Mayank,

Right, yes, with HTTP clients a live stream has to be started so packetizing can begin and be ready for playback.

Richard

---

<div class="post-metadata">

**Author:** ![Mayank\_Srivastava](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mayank\_Srivastava](https://community.wowza.com/u/Mayank_Srivastava)\
**Post date:** [March 11, 2014, 12:24am UTC](https://community.wowza.com/t/disconnect-streams-that-have-not-had-any-connections-for-some-past-duration-say-2hrs/42041/5 "2014-03-11T00:24:44Z")

</div>

Hi Richard,

So does that mean there is no other way to disconnect streams from IP cameras that no one has been watching for past some time and there will be incoming data feeds from those cameras for like forever? ☹

We are also supporting iOS devices so using rtp-live as stream type is not a viable solution for us.

Mayank.
