Error JSON request
Hello!
There is a program code HTML/JS:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Test API Binary
<div id=authorize></div> <div id=balance></div>var ws = new WebSocket('wss://ws.binaryws.com/websockets/v3?app_id=XXX'); // connection with the WebSocket server ws.onopen = function(evt) { ws.send(JSON.stringify({authorize: 'XXXXXXXXXXXXX'})); // authorization of the account ws.send(JSON.stringify({balance: '1'})); // request of data of balance }; ws.onmessage = function(msg) { var data = JSON.parse(msg.data); switch(data.msg_type) { case 'authorize': var aut= '
- E-mail:'+ data.authorize.email +'
- Currency:'+ data.authorize.currency +'
- Balance:'+ data.authorize.balance +'
- Loginid:'+ data.authorize.loginid +'
- msg_type:'+ data.msg_type +'
- Status:'+ ws.readyState +'
- Balance:'+ data.error.message +'
Problems:
- The first request of "authorize" works correctly - on the screen information on the account;
- The second request returns a error - «Please log in».
In what a error? I ask to help
Thanks