# Limit RTP-LIVE connections

**URL:** https://community.wowza.com/t/limit-rtp-live-connections/48583
**Category:** Wowza Developer Dojo
**Created:** [April 21, 2017, 3:00pm UTC](https://community.wowza.com/t/limit-rtp-live-connections/48583 "2017-04-21T15:00:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![John\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@John\_Anderson](https://community.wowza.com/u/John_Anderson)
#### Post date: [April 21, 2017, 3:00pm UTC](https://community.wowza.com/t/limit-rtp-live-connections/48583/1 "2017-04-21T15:00:18Z")

</div>

I need to limit the number of incoming cameras that the wowza server can simultaneously connect to. The streams are RTP\_LIVE, so a connection to the camera only occurs when a client wants to view a stream. But I need to limit the number of streams coming in from the gateway. I’m thinking that I could maintain a count for each connection started/stopped and then deny new connections when the limit is reached. But I’m not sure where in the API to intercept the RTP-LIVE connects. Any suggestions?

John

---

<div class="post-metadata">

### Author: ![Michelle\_B](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/michelle_b/32/394_2.png) [@Michelle\_B](https://community.wowza.com/u/Michelle_B)
#### Post date: [May 13, 2017, 1:14am UTC](https://community.wowza.com/t/limit-rtp-live-connections/48583/2 "2017-05-13T01:14:24Z")

</div>

Hi,

This was addressed in ticket #228085, but I am posting the response here as well:

This should be possible by creating an application-level property object that keeps track of the started streams. You can increment the property during onPublish, and reduce it during onUnPublish.

You can then add a listener during [resolvePlayAlias](https://www.wowza.com/docs/how-to-use-the-imediastreamnamealiasprovider2-interface) that will check if a limit has been reached, and deny playback (return null).

Michelle

---

<div class="post-metadata">

### Author: ![Hadi\_Daryadel](https://avatars.discourse-cdn.com/v4/letter/h/ad7895/32.png) [@Hadi\_Daryadel](https://community.wowza.com/u/Hadi_Daryadel)
#### Post date: [July 6, 2017, 6:19pm UTC](https://community.wowza.com/t/limit-rtp-live-connections/48583/4 "2017-07-06T18:19:16Z")

</div>

I was only able to just now get around to implementing this suggestion to implement resolvePlayAlias to control the connection. Unfortunately our installations use .stream files and this interface cannot be used. So I still need some event to stop from starting and publishing the stream.

---

<div class="post-metadata">

### Author: ![Michelle\_B](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/michelle_b/32/394_2.png) [@Michelle\_B](https://community.wowza.com/u/Michelle_B)
#### Post date: [July 25, 2017, 6:01am UTC](https://community.wowza.com/t/limit-rtp-live-connections/48583/5 "2017-07-25T06:01:37Z")

</div>

Hi Hadi,

As mentioned in your ticket, you should still be able to use .stream files with your resolvePlayAlias method. You will need to add the following code for your resolveStreamAlias method in order to do so.

```auto
    public String resolveStreamAlias(IApplicationInstance appInstance, String name)
    {
        return MediaCasterUtils.handleStreamAliasFile(appInstance, name);
    }

```

Michelle
