# API PubSub Limits

**URL:** <https://discuss.dev.twitch.com/t/api-pubsub-limits/28470>\
**Category:** API\
**Created:** [October 5, 2020, 9:23am UTC](https://discuss.dev.twitch.com/t/api-pubsub-limits/28470 "2020-10-05T09:23:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lefteris](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/lefteris/32/27983_2.png) [@Lefteris](https://discuss.dev.twitch.com/u/Lefteris)\
**Post date:** [October 5, 2020, 9:23am UTC](https://discuss.dev.twitch.com/t/api-pubsub-limits/28470/1 "2020-10-05T09:23:58Z")

</div>

Hi,

We have a Twitch Extension and we would like to use Twitch’s PubSub API.  
I’m just checking if there any limits to using the service.

We currently have a 3rd party PubSub integration and we are looking to replace it with the Twitch PubSub API service.  
We are broadcasting messages to all Extension users, roughly at a couple of minutes intervals.  
The number of messages depend on the number of events we generate on our Extension, but for a 2 hour stream, it would be something around 50 to 250.

Is that Ok, or this kind of usage is considered abusive?

Thank you!

---

<div class="post-metadata">

**Author:** ![Dist](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://discuss.dev.twitch.com/u/Dist)\
**Post date:** [October 5, 2020, 9:29am UTC](https://discuss.dev.twitch.com/t/api-pubsub-limits/28470/2 "2020-10-05T09:29:09Z")

</div>

The limits for Extension PubSub are mentioned here: [Building Extensions | Twitch Developers](https://dev.twitch.tv/docs/extensions/building#broadcasting-via-pubsub)

> [@](#):
>
> ### Broadcasting via PubSub
> 
> When the EBS wants to transmit real-time messages or state via PubSub, it will use the [Send Extension PubSub Message](https://dev.twitch.tv/docs/extensions/reference/#send-extension-pubsub-message) endpoint. Using this endpoint, your EBS can broadcast to all viewers of a given channel or to specific users via a whisper.
> 
> Adhere to these limits for Twitch PubSub traffic:
> 
> - 1 message per second per channel
> - 5 KB message size
> 
> These rules ensure the stability and scalability of our systems.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [October 5, 2020, 10:36am UTC](https://discuss.dev.twitch.com/t/api-pubsub-limits/28470/3 "2020-10-05T10:36:28Z")

</div>

The send a pubsub message API also returns headers to help keep within the timing constraints

For a Channels it is

> resp.headers[‘ratelimit-ratelimitermessagesbychannel-remaining’], ‘/’, resp.headers[‘ratelimit-ratelimitermessagesbychannel-limit’]

So you can use this to auto rate limit your sending logic

---

<div class="post-metadata">

**Author:** ![Lefteris](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/lefteris/32/27983_2.png) [@Lefteris](https://discuss.dev.twitch.com/u/Lefteris)\
**Post date:** [October 5, 2020, 11:06am UTC](https://discuss.dev.twitch.com/t/api-pubsub-limits/28470/4 "2020-10-05T11:06:15Z")

</div>

Thank you both!

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [November 4, 2020, 11:06am UTC](https://discuss.dev.twitch.com/t/api-pubsub-limits/28470/5 "2020-11-04T11:06:19Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
