NotificationHandler suggestion

Hi,

Currently the NotificationHandler cannot be used with a proxy. I suggest to update NotificationHandler.Builder with methods like

    public Builder withProxyHost(String proxyHost) {
        this.proxyHost = proxyHost;
        return this;
    }

The proxy parameters can then be used in the NotificationHandler(Builder builder) constructor as follows.

    // Create WebSocketFactory
    WebSocketFactory webSocketFactory = new WebSocketFactory();

    // Set proxy
    if (builder.proxyHost != null) {
        ProxySettings proxySettings = webSocketFactory.getProxySettings();
        proxySettings.setHost(builder.proxyHost);
    }

That seems like a reasonable request. I've created API-2743 for this work. I should be able to work on this in early August.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.

@vitaly I've implemented NotificationHandler.Builder.withProxyHost(String) to allow you to set a proxy host for the websocket connection. You should provide the proxy host as a URI, e.g. https://myproxy.com:443. This is available in version 24.0.0.

However, I wasn't able to successfully test this as I couldn't get my hands on a proxy that supported websocket connections. If you run into issues, be sure to implement the WebSocketListener interface and provide an instance of your class to the withWebSocketListener(WebSocketListener) builder method. If you know of any public websocket proxy servers, let me know and I'll give it a try.

Thanks Tim. I'll give it a try as soon as I have chance to get back to that application.

1 Like