Sorry, we don't support your browser.  Install a modern browser

Unable to connect to WS from Java app#21

I’m unable to open a websocket connection from a Java app, with the following error:

Closed wss://lb.n.vega.xyz/query - draft Draft_6455 extension: DefaultExtension max frame size: 2147483647 refuses handshake

I’m raising a ticket because it’s strange for the following reasons:

  1. The same Java code connects to major exchanges fine; Binance, Bitfinex, Coinbase, FTX, etc.
  2. I was able to connect to Vega from a Python application using the same URL
  3. Googling the error doesn’t return any useful results that suggest it is a problem with the Java library

Happy to help someone debug what’s going on when you get round to looking at this one.

3 months ago
?

Just a thought on this Bill - it might be a much easier integration if we generate you a gRPC API client for Java. (Like we have for Python)

3 months ago

Hey thanks for the reply.

I can create my own, but everything else is websocket based, and I was trying to adopt a consistent framework across like 30+ exchanges. I’ve made a note to explore gRPC specifically for Vega, but I wondered if this issue could be related to a minor configuration issue on the server-side, and fixing it would make it easier for people to onboard with the testnet, as they would get the same experience with Vega as they do with other major exchanges.

Although admittedly, could just be the case that I am using the wrong client library for your specific setup, in which case gRPC will be the way to go!

3 months ago
?

It could be an SSL issue having had a look online. We use letsencrypt for our SSL certificates and I think this can sometimes cause problems in the Java signing cert tree. Let’s chat on Discord and work through this.

3 months ago
Changed the status to
In Progress
2 months ago
Z

Hi Bill, not sure if this is relevant, but I had to pass the subprotocol “graphql-ws” along with the URL to connect when using node. Python worked fine without specifying the subprotocol.

I don’t know anything about Java, but from a quick google it seems like Draft_6455 might have something to do with an empty protocol

2 months ago

Managed to get this to work with help from Zach. Had to pass a custom Draft_6455 object to the Websocket constructor, defining the sub protocol as graphql-ws:

class VegaWebSocketClient extends WebSocketClient pubic VegaWebSocketClient(URI uri) super(uri, new Draft_6455(Collections.emptyList(), Collections.singletonList(new Protocol(“graphql-ws”))););
}
}

2 months ago
2

That’s great to hear! Thanks for letting us know @Bitcoin Bill.

2 months ago