Socket API Documentation

Socket - Real Time Updates

Before Socket Api, all developers were sending request every second on our server to get latest price. But now we introduce Socket API, Socket.io Is a JS library that helps you to connect with our server on realtime connection, Socket API will reduce latency 5 minutes to 1 milli seconds.
If you have no idea about Socket.io Please read here. Documentaion

Get Started

To use socket.io you need a little knowledge about JS, We allow socket connection from Server to Server AND Client Browser to our Server.

Example: How Frequently prices update with socket connection

Note: Market closed on saturday and sunday, so you will not see any price changes

1) Client Browser To Server Connection

If you want to get all real time pricing on your browser to show to your visitors. No special installation you need.
All guide are mention in socket_browser.js file.
Download Simple Socket Code and run index.html file in browser

Skills Required
HTML and Java Script

Quick Code Guide
<script src="socket.io.js"></script> 
<script>
var api_key = 'API_KEY'; // Your API KEY
var currency_ids = '1,2,3'; // Your FX currency multiple IDs

// socket connection function
function socket_connection(){
// Connection
var socket = io.connect("wss://fxpricing.com",{transports: ['websocket']});

// Verify Your API key on server
socket.emit('heartbeat', api_key);

// Connect Ids on server
socket.emit('real_time_join', currency_ids);

socket.on('data_received',function(data){
  // always receive latest price here in "data" variable
  // data contain : Price, ASK price, BID price
  console.log(data);
});
} // function end


// Calling function
socket_connection();
</script>

2) Server To Server Connection

If you want to get all real-time pricing directly on your server you need little knowledge about "JS", "Nodejs" and "cmd in windows OR terminal in Linux".
You need to install Nodejs on your windows/Linux Server, Create empty project folder, and run our server.js file in CMD/terminal.
Download server.js File

If you have no idea about socket.io then we recommend you to learn "how to build simple Chat app with socket.io" After that, you will learn all skills that you need to run our code. Offical Documentation

Skills Required
Java Script (Required),
Socket.io (Good if you know)
NodeJS (Not required, just install in your machine),

Socket - Price Plan

Normal pricing plan on the pricing page does not include socket access, you need to contact us for socket connection access. Below are two plans for socket connection.

  • Plan 1: Client Browser To FCS server connection, $300/month
    Direct connection from browser to FCS server is allow. With plan 1 you don't need your own nodejs or socket port connection, We allow you to connect your visitors directly with FCS server, Or you can directly access currency updates from browsers.

  • Plan 2: Client Server To FCS Server connection, $60/month
    Direct connection from browser to FCS server is NOT allow. Only 1 connection allow from your machine to FCS.
    If you have 1000 visitors and you want to connect your all visitors with Socket connection then you need to provide them service from your own socket connection.
    You need to create your own nodejs/socket connection and then connect your Visitors with your server.

No difference between Plan 1 and Plan 2 except number of connection limit.

Disclaimer

Prices, Market trends and signals are not designed for trading purpose, These signals are only for education or non-commercial purpose use. Data contained in this application/website is not necessarily real-time nor accurate and so prices may not be accurate and may differ from the actual market price, meaning prices are indicative and not appropriate for trading purposes. Therefore we doesn`t bear any responsibility for any trading losses you might incur as a result of using this data.
Latest price minimum refresh rate is 5 Seconds