bitvavo / java-bitvavo-api

Java wrapper for the Bitvavo API
ISC License
9 stars 14 forks source link

Bugfix for Example: The HTTP request to initiate the WebSocket connection to [wss://ws.bitvavo.com/v2/] failed #14

Open atienkamp opened 2 years ago

atienkamp commented 2 years ago

The example tests werent working for websockets. setting the buffer size fixed this issue:

    public WebsocketClientEndpoint(URI endpointURI, Bitvavo bitv) {
        try {
            bitvavo = bitv;
            WebSocketContainer container = ContainerProvider.getWebSocketContainer();
            container.setDefaultMaxBinaryMessageBufferSize(1024*1024);
            container.setDefaultMaxTextMessageBufferSize(1024*1024);
            container.connectToServer(this, endpointURI);
        } catch (Exception e) {
            e.printStackTrace();
            bitvavo.errorToConsole("Caught exception in instantiating websocket." + e);
            this.reconnectTimer = 100;
            retryConnecting(endpointURI);
        }
    }

https://github.com/bitvavo/java-bitvavo-api/blob/471b5aedd15e3330edc4dd886e19ce77a50a24b9/src/main/java/com/bitvavo/api/WebsocketClientEndpoint.java#L65