How to use the @algolia/transporter.Transporter function in @algolia/transporter

To help you get started, we’ve selected a few @algolia/transporter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / algoliasearch-client-javascript / packages / search-client / src / SearchClient.ts View on Github external
public constructor(options: SearchClientOptions & TransporterOptions) {
    this.appId = options.appId;
    this.transporter = new Transporter(options);
    this.transporter.setHosts(
      [
        { url: `${this.appId}-dsn.algolia.net`, accept: Call.Read },
        { url: `${this.appId}.algolia.net`, accept: Call.Write },
      ].concat(
        shuffle([
          { url: `${this.appId}-1.algolianet.com`, accept: Call.Any },
          { url: `${this.appId}-2.algolianet.com`, accept: Call.Any },
          { url: `${this.appId}-3.algolianet.com`, accept: Call.Any },
        ])
      )
    );

    const auth = new Auth(
      options.authMode !== undefined ? options.authMode : AuthMode.WithinHeaders,
      this.appId,