New to Twitch Extensions? Start here with a rundown of Extension architecture, practical considerations, and common mistakes to avoid when building an Extension.
Report
Share
Report
Share
1 of 24
Download to read offline
More Related Content
Twitch Extensions 101
1. TwitchCon 2018 San Jose, California
Greg Humphreys
Extensions Tech Lead
@deflatormouse7
Andy Morrell
Dev Speedrunner
@LuckyNoS7evin
14. TwitchCon 2018 San Jose, California
JSON Web Tokens (JWT)
Opaque User ID
Channel ID
Role
Twitch User ID
1
2
3
4
Authorization &
Per-User Data
15. createNewPoll(request) {
incomingToken = getJWT(request)
if not verifySignature(incomingToken, sharedSecret) {
return 401
}
if incomingToken["role"] != "broadcaster" {
return 403
}
questions = getPollQuestions(request)
poll = setupPoll(request)
outgoingToken = createAndSignJWT(
incomingToken["user_id"],
incomingToken["channel_id"],
sharedSecret)
sendPollOverPubsub(poll, outgoingToken)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
New Poll Backend
Example
// Extract JWT
// Check for proper signature
// Now that we trust the
// JWT, verify that the
// broadcaster requested this
// Construct a new JWT
// using our shared signature
// and use that JWT to
// authorize a broadcast
// over Twitch PubSub
16. TwitchCon 2018 San Jose, California
Practical Considerations
and Common Mistakes
Andy Morrell @LuckyNoS7evin
17. Pitfalls &
Issues
PRACTICAL CONSIDERATIONS & COMMON MISTAKES
Scaling
Include the Extension Helper Library
- <script src="https://extension-
files.twitch.tv/helper/v1/twitch-
ext.min.js"></script>
PubSub Rate Limits
- 1 message per second, per channel
- 1 message per second to “global”
Secret Rotation
- Please keep your EBS safe; rotate your
secret every 12 hours
- Previous secret still available for up to an
hour
Zip Assets
- Wrong directory
18. TwitchCon 2018 San Jose, California
iOS Support
Join the Apple Developer Program, this is
required for you Extension tp be on mobile
iOS devices
JSON Web Tokens (JWT)
4 Types of JWT, 6 variations
User not Authenticated User Authenticated:
- User Authenticated & Not Sharing User ID
- User Authenticated & Sharing User ID
Shared
Pitfalls &
Issues
PRACTICAL CONSIDERATIONS & COMMON MISTAKES
Broadcaster
EBS
- Signed
- Signed with PubSub Broadcast to Channel
- Signed with PubSub Global
20. TwitchCon 2018 San Jose, California
What is it for
- Get your Extension up and running quickly,
with faster iteration
- A lot better than when there was no rig
Developer Rig
PRACTICAL CONSIDERATIONS & COMMON MISTAKES
Where to get it
- https://dev.twitch.tv/dashboard/extensions
- https://github.com/twitchdev/developer-rig
Prerequisites
- Node
- Yarn
- Python 2
- Git
21. TwitchCon 2018 San Jose, California
Scaling
Bursty Traffic
- Single or Multiple Channel; build to your needs
- Multiple Channel
‣ Possible two million unique broadcasters a
month
‣ Hundreds of thousands of requests in bursts
Twitch AWS Program
- https://dev.twitch.tv/extensions/aws
My Architecture and Mistakes
- Single server
- Single application
- Microservices
PRACTICAL CONSIDERATIONS & COMMON MISTAKES
22. Other Talks To Attend
- Get Your Extension Discovered
- Rapid Prototyping Twitch Extensions
- Monetize your Extension One Bit at a Time
- Extension Design Patterns for Twitch Scale