# OnConnectAccept() method returns 0 playstream count

**URL:** <https://community.wowza.com/t/onconnectaccept-method-returns-0-playstream-count/51954>\
**Category:** Wowza Streaming Engine\
**Created:** [September 17, 2018, 3:37pm UTC](https://community.wowza.com/t/onconnectaccept-method-returns-0-playstream-count/51954 "2018-09-17T15:37:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![timothe\_jahan](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@timothe\_jahan](https://community.wowza.com/u/timothe_jahan)\
**Post date:** [September 17, 2018, 3:37pm UTC](https://community.wowza.com/t/onconnectaccept-method-returns-0-playstream-count/51954/1 "2018-09-17T15:37:05Z")

</div>

Hi,

I am writing a small module so that everytime a client starts or stop a stream I update an external DB, so I can keep a live view of who exactly is watching the live stream at anytime.

I’m using the onConnectAccept method by using the getClient methods, getUri & getQueryStr I’m gathering all the data I need, except the actual stream that client is playing.

My problem is that by using the getPlayStreamsCount method I get a count of “0”, which I would not expect as the connection is already accepted.

What would be the correct way of getting this info ?

Should I use “OnStreamCreate” & then get the Client info from the getClient method ?

Thx

---

<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 18, 2018, 3:56pm UTC](https://community.wowza.com/t/onconnectaccept-method-returns-0-playstream-count/51954/2 "2018-09-18T15:56:07Z")

</div>

@timothe jahan, the advice from our engineer team is here:

For RTMP, the best option would be to extend the `MediaStreamActionNotifyBase` class and override the `onPlay` and `onStop` methods. For http and rtp streams, the relevant session create and destroy methods should be fine.

What they do need to be careful with when sending data to a remote endpoint is that they don’t stall the server waiting for a response. They should implement their own thread pools or executor to handle the send asynchronously.

---

<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 18, 2018, 3:57pm UTC](https://community.wowza.com/t/onconnectaccept-method-returns-0-playstream-count/51954/3 "2018-09-18T15:57:03Z")

</div>

If you need assistance setting this up, please submit a support ticket- thanks.

**[https://www.wowza.com/support/open-ticket](https://www.wowza.com/support/open-ticket)**

---

<div class="post-metadata">

**Author:** ![technique\_tad](https://avatars.discourse-cdn.com/v4/letter/t/ccd318/32.png) [@technique\_tad](https://community.wowza.com/u/technique_tad)\
**Post date:** [January 12, 2019, 11:31am UTC](https://community.wowza.com/t/onconnectaccept-method-returns-0-playstream-count/51954/4 "2019-01-12T11:31:28Z")

</div>

Hello,

Thanks for the answer, I had paused that effort as I was in “feasibility phase” but we now purchased a wowza license so I need to get this to work.

So far I’ll focus on the http sessions which should be sufficient for me. Could you specify the exact method I should modify, possibly even providing code sample ?

Is it the

com.wowza.wms.httpstreamer.model.notifyHTTPSessionCreate

and the com.wowza.wms.httpstreamer.model.notifyHTTPSessionDestroy ?

What is the right syntax to overide the current method without loosing the existing functionality.

Thanks
