Debug Options

The Muxy SDK optionally takes a debug options object to override some default values. You pass any of these values to the Muxy.debug function before calling Muxy.setup.

Using

To set debugging options, you first create a DebuggingOptions object. This object has chainable member functions to set any of the available debug options.

const opts = new Muxy.DebuggingOptions();
opts.channelID('126955211').role('broadcaster').jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6I...');

Muxy.debug(opts);
Muxy.setup({
  clientID: '<extension client id>'
});

Debug Options

field description
channelID The Twitch channel ID to simulate running on
userID The Twitch user ID for all viewer requests
role The Twitch ‘role’ for the current viewer (one of viewer, broadcaster, admin)
jwt A self-signed JWT to use for all backend requests

Self-Signed JWT

One of the more powerful debugging options is jwt. Since, as a developer, you have access to the Client ID and Secret for your extension, you can sign a JWT that will verify your requests. We do this internally for you when your extension is running in sandbox or production environments, but you may want to do this yourself if you are running parts of your extension on your own site.

The process is the same as the “Signing the JWT” section of Server Communication.

Once you have your encoded JWT (in the form eyJhbGciOiJIUzI1NiIsInR5cCI6I...), you can pass this as a debugging option when initializing the Muxy SDK:

const opts = new Muxy.DebuggingOptions();
opts.role('broadcaster').jwt('eyJhbGciOiJIUzI1NiIsInR5cCI6I...');

Muxy.debug(opts);
Muxy.setup({
  clientID: '<extension client id>'
});

const sdk = new Muxy.SDK();
sdk.loaded().then(() => {
  sdk.setChannelState({ broadcasters_age: 24 }); // Normally live-dashboard or config only.
});