diff --git a/examples/dynamicControls.ts b/examples/dynamicControls.ts index 55acea7..445003b 100644 --- a/examples/dynamicControls.ts +++ b/examples/dynamicControls.ts @@ -12,7 +12,7 @@ import { setWebSocket, } from '../lib'; -if (process.argv.length < 5) { +if (process.argv.length < 4) { console.log('Usage gameClient.exe '); process.exit(); } diff --git a/examples/groups.ts b/examples/groups.ts index c01193c..21241ab 100644 --- a/examples/groups.ts +++ b/examples/groups.ts @@ -160,7 +160,7 @@ function createGroups(): Promise { // Now we open the connection passing in our authentication details and an experienceId. client - // Open the Beam client with command line args + // Open the Mixer interactive client with command line args .open({ authToken: process.argv[2], versionId: parseInt(process.argv[3], 10), diff --git a/examples/updateControl.ts b/examples/updateControl.ts index 08d762b..51fa09d 100644 --- a/examples/updateControl.ts +++ b/examples/updateControl.ts @@ -9,7 +9,7 @@ import { setWebSocket, } from '../lib'; -if (process.argv.length < 5) { +if (process.argv.length < 4) { console.log('Usage gameClient.exe '); process.exit(); } @@ -71,7 +71,6 @@ function makeControls(amount: number): IControlData[] { // Now we open the connection passing in our authentication details and an experienceId. client.open({ authToken: process.argv[2], - url: process.argv[3], versionId: parseInt(process.argv[4], 10), }) .then(() => { diff --git a/src/EndpointDiscovery.ts b/src/EndpointDiscovery.ts index 00f8792..3d854b4 100644 --- a/src/EndpointDiscovery.ts +++ b/src/EndpointDiscovery.ts @@ -5,17 +5,15 @@ export interface IInteractiveEndpoint { address: string; } -const endpoint = `https://beam.pro/api/v1/interactive/hosts`; - export class EndpointDiscovery { constructor(private requester: IRequester) {} /** - * Retrieves available interactive servers from Beam's REST API. + * Retrieves available interactive servers from Mixer's REST API. * Game Clients should connect to the first one in the list and use * other servers in the list should a connection attempt to the first * fail. */ - public retrieveEndpoints(): Promise { + public retrieveEndpoints(endpoint: string = 'https://mixer.com/api/v1/interactive/hosts'): Promise { return this.requester.request(endpoint) .then(res => { if (res.length > 0) { diff --git a/src/GameClient.ts b/src/GameClient.ts index 5d4ed4c..98412b3 100644 --- a/src/GameClient.ts +++ b/src/GameClient.ts @@ -14,17 +14,19 @@ import { IControl } from './state/interfaces/controls/IControl'; export interface IGameClientOptions { /** * Your project version id is a unique id to your Interactive Project Version. You can retrieve one - * from the Interactive Studio on Beam.pro in the Code step. + * from the Interactive Studio on Mixer.com in the Code step. */ versionId: number; /** * An OAuth Bearer token as defined in {@link https://art.tools.ietf.org/html/rfc6750| OAuth 2.0 Bearer Token Usage}. */ authToken: string; + /** - * An interactive server url, these should be retrieved from https://beam.pro/api/v1/interactive/hosts. + * A url which can be used to discover interactive servers. + * Defaults to https://mixer.com/api/v1/interactive/hosts */ - url?: string; + discoveryUrl?: string; } export class GameClient extends Client { @@ -37,7 +39,7 @@ export class GameClient extends Client { */ public open(options: IGameClientOptions): Promise { return this.discovery - .retrieveEndpoints() + .retrieveEndpoints(options.discoveryUrl) .then(endpoints => { return super.open({ authToken: options.authToken, diff --git a/src/ParticipantClient.ts b/src/ParticipantClient.ts index 16b8d64..de6718f 100644 --- a/src/ParticipantClient.ts +++ b/src/ParticipantClient.ts @@ -4,13 +4,13 @@ import { IInput } from './state/interfaces/controls'; export interface IParticipantOptions { /** - * A JWT representing a Beam.pro session + * A JWT representing a Mixer.com session */ jwt: string; /** * A url for the Interactive session you'd like to join. - * This should be retrieved from https://beam.pro/api/v1/interactive/{channelId} - * @example wss://interactive1-dal.beam.pro/participant?channel= + * This should be retrieved from https://mixer.com/api/v1/interactive/{channelId} + * @example wss://interactive1-dal.mixer.com/participant?channel= */ url: string; /** diff --git a/src/state/State.ts b/src/state/State.ts index fe197b7..0a568ca 100644 --- a/src/state/State.ts +++ b/src/state/State.ts @@ -49,7 +49,7 @@ export class State extends EventEmitter implements IState { /** * Constructs a new State instance. Based on the passed client type it will - * hook into the apropriate methods for that type to keep itself up to date. + * hook into the appropriate methods for that type to keep itself up to date. */ constructor(private clientType: ClientType) { super(); @@ -187,7 +187,7 @@ export class State extends EventEmitter implements IState { } /** - * Returns the local time matched to the sync of the Beam server clock. + * Returns the local time matched to the sync of the Mixer server clock. */ public synchronizeLocalTime(time: Date | number = Date.now()): Date { if (time instanceof Date) { @@ -346,14 +346,14 @@ export class State extends EventEmitter implements IState { return result; } /** - * Retrieve a participant by their Beam UserId. + * Retrieve a participant by their Mixer UserId. */ public getParticipantByUserID(id: number): IParticipant { return this.getParticipantBy('userID', id); } /** - * Retrieve a participant by their Beam Username. + * Retrieve a participant by their Mixer Username. */ public getParticipantByUsername(name: string): IParticipant { return this.getParticipantBy('username', name); diff --git a/src/state/interfaces/IParticipant.ts b/src/state/interfaces/IParticipant.ts index e440176..3602316 100644 --- a/src/state/interfaces/IParticipant.ts +++ b/src/state/interfaces/IParticipant.ts @@ -13,15 +13,15 @@ export interface IParticipant { */ sessionID: string; /** - * This participant's Beam UserId + * This participant's Mixer UserId */ userID?: number; /** - * This participant's Beam Username + * This participant's Mixer Username */ username?: string; /** - * This participant's Beam level + * This participant's Mixer level */ level?: number; /**