Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TwitchClientHelper allow more than 100 channels to be added for GoLiveEvent #121

Closed
3 tasks done
jonteohr opened this issue May 8, 2020 · 2 comments
Closed
3 tasks done

Comments

@jonteohr
Copy link
Contributor

jonteohr commented May 8, 2020

Prerequisites

  • If this is a question/suggestion, I have already considered discuss it on Discord Server
  • This issue specifically has something to do with Twitch4J
  • I have attempted to look for similar issues already

Description

As my application is growing I've noticed that it now has stopped working since I'm making too many requests. I'm using the ChannelGoLiveEvent and I need more than 100 channels to listen to. Just over 500 to be exact.

Solutions

If I've done twitchClient.getClientHelper().enableStreamEventListener("channel"); more than 100 times, then split the list listenForGoLive and inside the Client Helper send the request multiple times with the splitted lists, to support more than 100 channels.

Alternatives

I've tried using the TwitchClientHelper class to try to replicate the function and modify it myself, but I can't seem to make it work. However I am sure this is due to the limits of my Java knowledge. I'm sure anyone with more knowledge would be able to do this quite easy.

Additional context

@JellyBrick
Copy link

My solution (temporary fix)

private val eventManager = EventManager().apply {
  registerEventHandler(SimpleEventHandler())
}

...

  val twitchClientOne = buildTwitchClient()
  val twitchClientTwo = buildTwitchClient()
  eventManager.getEventHandler(SimpleEventHandler::class.java).onEvent(ChannelGoLiveEvent::class.java, eventHandler)

...

private fun buildTwitchClient(): TwitchClient {
  TwitchClientBuilder.builder()
    .withClientId(clientId)
    .withClientSecret(clientSecret)
    .withEnableHelix(true)
    .withEventManager(eventManager)
    .build()
}

@jonteohr
Copy link
Contributor Author

@JellyBrick I tried that before but must've done it incorrectly. When I tried it again by a different method it works fine. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants