Search in sources :

Example 1 with WebsocketSubprotocol

use of io.smallrye.graphql.client.websocket.WebsocketSubprotocol in project smallrye-graphql by smallrye.

the class VertxTypesafeGraphQLClientBuilder method applyConfig.

/**
 * Applies values from known global configuration. This does NOT override values passed to this
 * builder by method calls.
 */
private void applyConfig(GraphQLClientConfiguration configuration) {
    if (this.endpoint == null && configuration.getUrl() != null) {
        this.endpoint = URI.create(configuration.getUrl());
    }
    if (this.websocketUrl == null && configuration.getWebsocketUrl() != null) {
        this.websocketUrl = configuration.getWebsocketUrl();
    }
    if (this.headers == null && configuration.getHeaders() != null) {
        this.headers = configuration.getHeaders();
    }
    if (this.websocketInitializationTimeout == null && configuration.getWebsocketInitializationTimeout() != null) {
        this.websocketInitializationTimeout = configuration.getWebsocketInitializationTimeout();
    }
    if (executeSingleOperationsOverWebsocket == null && configuration.getExecuteSingleOperationsOverWebsocket() != null) {
        this.executeSingleOperationsOverWebsocket = configuration.getExecuteSingleOperationsOverWebsocket();
    }
    if (configuration.getWebsocketSubprotocols() != null) {
        configuration.getWebsocketSubprotocols().forEach(protocol -> {
            try {
                WebsocketSubprotocol e = WebsocketSubprotocol.fromString(protocol);
                this.subprotocols.add(e);
            } catch (IllegalArgumentException e) {
                log.warn(e);
            }
        });
    }
    VertxClientOptionsHelper.applyConfigToVertxOptions(options, configuration);
}
Also used : WebsocketSubprotocol(io.smallrye.graphql.client.websocket.WebsocketSubprotocol)

Example 2 with WebsocketSubprotocol

use of io.smallrye.graphql.client.websocket.WebsocketSubprotocol in project smallrye-graphql by smallrye.

the class VertxDynamicGraphQLClientBuilder method applyConfig.

/**
 * Applies values from known global configuration. This does NOT override values passed to this
 * builder by method calls.
 */
private void applyConfig(GraphQLClientConfiguration configuration) {
    if (this.url == null && configuration.getUrl() != null) {
        this.url = configuration.getUrl();
    }
    if (this.websocketUrl == null && configuration.getWebsocketUrl() != null) {
        this.websocketUrl = configuration.getWebsocketUrl();
    }
    configuration.getHeaders().forEach((k, v) -> {
        if (!this.headersMap.contains(k)) {
            this.headersMap.set(k, v);
        }
    });
    if (configuration.getWebsocketSubprotocols() != null) {
        configuration.getWebsocketSubprotocols().forEach(protocol -> {
            try {
                WebsocketSubprotocol e = WebsocketSubprotocol.fromString(protocol);
                this.subprotocols.add(e);
            } catch (IllegalArgumentException e) {
                log.warn(e);
            }
        });
    }
    if (subscriptionInitializationTimeout == null && configuration.getWebsocketInitializationTimeout() != null) {
        this.subscriptionInitializationTimeout = configuration.getWebsocketInitializationTimeout();
    }
    if (executeSingleOperationsOverWebsocket == null && configuration.getExecuteSingleOperationsOverWebsocket() != null) {
        this.executeSingleOperationsOverWebsocket = configuration.getExecuteSingleOperationsOverWebsocket();
    }
    VertxClientOptionsHelper.applyConfigToVertxOptions(options, configuration);
}
Also used : WebsocketSubprotocol(io.smallrye.graphql.client.websocket.WebsocketSubprotocol)

Aggregations

WebsocketSubprotocol (io.smallrye.graphql.client.websocket.WebsocketSubprotocol)2