Binary.com has been rebranded to Deriv
Same login credentials. Same API. Improved experience
Server status updates
What is it?
The API provides a way to let clients check on whether the website is online or not through the website status call.
Subscribing to server status notifications
Here is a JavaScript code snippet that opens a websocket and makes a subscription for server status notifications. On receipt of a message, it emits the website status as well a message about the status, if available:
const WebSocket = require('ws');
const ws = new WebSocket('wss://ws.binaryws.com/websockets/v3?l=EN&app_id=1089');
ws.on('open', function open() {
ws.send(JSON.stringify({
website_status: 1,
subscribe: 1
}));
});
ws.on('message', function incoming(data) {
data = JSON.parse(data);
console.log('website status: %s', data.website_status.site_status);
if (data.website_status.message) {
console.log('status message: %s', data.website_status.message);
}
});