Random WebSocket Disconnections

I am working on an app where I am connecting via Websocket to different exchanges to listen for order updates.
What I am seeing is occasional disconnects happening for the exchanges that are using cloudflare - bitfinex, coinbase and okx to be exact. For the other exchanges that I am connecting to (and they dont seem to be using cloudflare based on the investigation) the issue is not present.
The reason/code that I am receiving is
reason: Unexpected Status of SSLEngineResult after an unwrap() operation
code: 1006.
I have implemented a reconnection mechanism and it works fine, but I am trying to understand why this happens in the first place.

I am using Java 11 + Spring Boot 2 along with the default implementation of Tomcat Websockets (also tested Java 17 + Spring Boot 3 but same behavior).
The service is running on AWS -a Kubernetes Pod which is in a Private VPC and is using NAT Gateway to access the Websocket API’s.

Thanks a lot for the help.
Best Regards

What i forgot to mention is that ping/pong mechanisms are implemented as well (although for Bitfinex/Coinbase they are not clearly explained in the API).

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