Archive. I wrote these docs in 2021 and 2022 for Fine Exchange, a crypto exchange project built on HollaEx Kit. The project ended in 2022: the exchange, its accounts, its API and AOM are no longer available, and nothing on this site is an offer of any service. Jeevanjot Singh Vital

Custom Websocket Client

Create Custom Websocket client to connect with Fine Exchange Server

For an easier way to use websockets with Fine Exchange and Hollaex Network, Visit the guide

Requirements

Public Usage

You need to import ws library and create a connection with Fine Exchange, For e.g

const WebSocket = require('ws');
const API_URL = 'https://api.fine.exchange'

// Public connection
const publicSocket = new WebSocket(`${API_URL}/stream`);

Private Usage

You need to authenticate through the api either using Bearer token or with API key and Secret which you can obtain from the guide

API Expires field just used to define the validity of the connection.

const WebSocket = require('ws');
const API_URL = 'https://api.fine.exchange'

// Bearer Token
const privateSocket = new WebSocket(`${API_URL}/stream?authorization=${BEARER_TOKEN}`);

// HMAC Authentication
const privateSocket = new WebSocket(`${API_URL}/stream?api-key=${API_KEY}&api-signature=${API_SIGNATURE}&api-expires=${API_EXPIRES}`);

// Bearer Token
privateSocket.send(
	JSON.stringify({
		op: 'auth',
		args: [{
			authorization: BEARER_TOKEN
		}]
	})
);

// HMAC Authentication
privateSocket.send(
	JSON.stringify({
		op: 'auth',
		args: [{
			'api-key': API_KEY,
			'api-signature': API_SIGNATURE,
			'api-expires': API_EXPIRES
		}]
	})
);

For a detailed documentation and to learn how it works with Hollaex Network, Please visit the Repository