Skip to content

Support for custom WebSockets subscription URL #274

@c-davor

Description

@c-davor

Issue described below is related to v3.0.1

The library does not allow configuring a separate URL for the WebSocket subscriptions endpoint. Instead it determines the WebSocket endpoint based on the ApiUrl provided in the configuration in WebSocketConnectionManager.getConnectionRequestUrl:

  return new Uri.Builder()
            .scheme("wss")
            .authority(appSyncEndpoint.getHost()
                .replace("appsync-api", "appsync-realtime-api"))
            .appendPath(appSyncEndpoint.getPath())
            .appendQueryParameter("header", Base64.encodeToString(rawHeader, Base64.DEFAULT))
            .appendQueryParameter("payload", "e30=")
            .build()
            .toString();

This does not seem to be clearly documented and no proper error is reported when a custom domain name is used for ApiUrl (eg. https://our.custom.domain.com/graphql) when subscription is executed.
In our use case the AppSyncSubscriptionCall.Callback.onFailure is raised with "Expected HTTP 101 response but was '400 Bad Request'"

For us, using the "full URL" (eg. https://abcde123565defghj.appsync-api.eu-west-1.amazonaws.com/graphql) is not possible for all use cases.

The only workaround we have currently is to have separate instance of AppSync client for subscriptions, configured with the full URL and additional instances for all other GraphQL operations configured with URL with a custom domain name.

Please provide additional configuration property allowing configuration of the WebSocket endpoint for GraphQL subscriptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions