Comments (5)
Absolutely!
So what I've been working on is a decoupled system in which outbound Twitch API calls are processed in their own stand alone microservice via RPC's. Right now, if I want to call a Twitch API using this library, I would need to have some sort of locking mechanism to ensure concurrent use of the library isn't done across multiple users.
For example, let's say I have 200 users with 200 user tokens that have been granted permission to a bot. Every time I want to call the Twitch API for something, I would send an RPC to the microservice I wrote that contains your Twitch library. This service would then call your Twitch library with the end user credentials by first calling SetUserAccessToken
method on the client from your library.
The problem here is, I can't have multiple tokens in use concurrently across the same instantiation of this library, because the user token it self is stored as state in the library. I thus need to either implement locking so that only one user can use a client at a time, i.e. sync.Lock or client pooling.
Both solutions are undesirable as the API is stateless by nature -- there should be no need to lock or pool when the lowest level of the API (i.e. the http calls) is stateless.
What I propose is something like:
resp, err := client.GetUsers(
&helix.UsersParams{
IDs: []string{"26301881", "18074328"},
Logins: []string{"summit1g", "lirik"},
},
&helix.AuthOptions{
UserAccessToken: "some-access-token",
},
)
Does that clarify the problem?
Thanks!
from helix.
So I can understand your problem better, are you able to provide an example what you're trying to achieve with this library in its current state and the issues you're having?
from helix.
I agree that is generally a good idea on the surface, but without diving in and having a deeper look I'm not sure what changes need to be implemented.
I'm also rather busy at the moment and not sure when I'll be able to have a look at this.
from helix.
I'll take a look and outline what changes would need to be done in order to get this in place. At the very least, we should be able to measure the level of effort here.
from helix.
I'm running into similar issues with wanting to have multitenant applications has this feature been abandoned?
from helix.
Related Issues (20)
- Allow querying multiple channels with `GetChannelInformation`
- Proposal: Add default rate limit function HOT 2
- Client does not use AppAccessToken on calls that must use AppAccessToken HOT 4
- missing api endpoints
- Need to add VodOffset. HOT 2
- Latest Release is 12.13.0 not 2.13.0 HOT 1
- Endpoint errors but returned error is nil
- Support `tags` for the stream resource HOT 1
- Implement Schedule endpoints
- Auto Refreshing Access Tokens
- Update follows endpoint to new version HOT 1
- When scope for endpoint is missing in the access token, it gets locked in a loop refreshing the access token
- Proposal: Context for methods, not for struct itself
- GetBlockedTerms() does not use provided data HOT 2
- AddBlockedTerm() does not use provided data HOT 2
- Add send message endpoint request
- GetBannedUsers() returns nothing HOT 14
- event EventSubChannelPredictionEndEvent json ended_at typo HOT 1
- Most recent patch release broke "API" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from helix.