Matlab fatal alert protocol_version when using urlread2 / websocket

3 views (last 30 days)
I am trying to connect Matlab with the cex.io Websocket API (https://cex.io/websocket-api-dsl) using this Matlab Websocktet Implementation: https://github.com/jebej/MatlabWebSocket. This websocket works just fine for various other brokers such as bitfinex or gdax.
However, when I try to establish the connection with cex.io like so:
% establish websocket connection
cex = SimpleClient('wss://ws.cex.io/ws');
I receive the following error:
Error: Received fatal alert: protocol_version
Error: Received fatal alert: protocol_version
Disconnected from server at wss://ws.cex.io/ws
I have come across the exact same error when trying to fetch data from cex.io RESTful API when using urlread2 (https://de.mathworks.com/matlabcentral/fileexchange/35693-urlread2) - see the example below:
% define url
url = 'https://cex.io/api/ticker/BTC/USD';
% make request using urlread2 - throws an error
response = urlread2(url);
Response stream is undefined
below is a Java Error dump (truncated):
Error using urlread2 (line 217)
Java exception occurred:
javax.net.ssl.SSLException: Received fatal alert: protocol_version
For the RESTful API, I was able to solve the issue with using the Matlab native webread function. Since I have had no issues with using urlread2 for the majority of other brokers I want to connect to, I assume the problem is specific to cex.io and urlread2. Since the same error arisis when trying to connect to the websocket, I suspect the issues are related, but I am not 100% sure about this.
Does anyone have an idea on how I can solve this problem?
Thanks in advance!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!