Custom domain with aws-appsync's AppsyncClientService

0

Hi,

I am using the AppsyncClientService in Angular with the package aws-appsync and it worked fine for me - until I wanted to use custom domains for my AWS graphql interface - then subscriptions stopped to work (more precisely the websocket connection).

I was using following code:

public getAppsyncClient() {
    if (this.awsAppSyncClient == null) {
      this.awsAppSyncClient = new AWSAppSyncClient({
        url: aws_exports.aws_appsync_graphqlEndpoint,
        region: aws_exports.aws_project_region,
        auth: {
          type: AUTH_TYPE.API_KEY,
          apiKey: aws_exports.aws_appsync_apiKey
        },
        disableOffline: true
      }).hydrated();
    }
    return this.awsAppSyncClient;
  }

In some magical way, the specified address was converted from https://xxx.appsync-api.eu-central-1.amazonaws.com/graphql to wss://xxx.appsync-realtime-api.eu-central-1.amazonaws.com/graphql in the background. This does not happen using custom domains (where the realtime url is simply the http url + "/realtime"). So, AWSAppSyncClient lost its magic.

Is there any way to tell AWSAppSyncClient to use a custom websocket url?

Thanks for any hint!!

Big Red
已提问 2 年前64 查看次数