Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/core-concepts/websocket/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ WebSocket is especially great for services that require continuous data exchange
To open a WebSocket connection, we need to create `new WebSocket` using the special protocol `ws`or `wss` in the url. Here is how you can do that in `JavaScript`:

```js
let socket = new WebSocket('wss://ws.binaryws.com/websockets/v3?app_id=1089');
let socket = new WebSocket('wss://red.binaryws.com/websockets/v3?app_id=1089');
```

:::caution
Expand All @@ -49,7 +49,7 @@ Here’s an example in `JavaScript`:

```js
const app_id = 1089; // Replace with your app_id or leave as 1089 for testing.
const socket = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const socket = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);

socket.onopen = function (e) {
console.log('[open] Connection established');
Expand Down
7 changes: 7 additions & 0 deletions docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ keywords:
description: Getting started with Deriv API
---

:::danger
Kindly be informed that due to recent API usage guidelines, all third-party apps communications must use Deriv's API red servers at the following address
`red.binaryws.com`.
This restriction will be applied after 7 days and any traffic to the other servers from third-party apps will be rejected.
Please take the necessary action before the effective date.
:::

Our Documentation is divided in several sections:

- [Core concepts](category/core-concepts)
Expand Down
2 changes: 1 addition & 1 deletion docs/languages/javascript/get-country-list/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Your final code will be:

```js title="index.js"
const app_id = 1089; // Replace with your app_id or leave as 1089 for testing.
const websocket = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const websocket = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const ping_interval = 12000; // it's in milliseconds, which equals to 120 seconds
let interval;

Expand Down
5 changes: 3 additions & 2 deletions docs/languages/javascript/websocket-connection/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ If you're not familiar with WebSockets, please check out [our documentation](/do
:::

### Set up a WebSocket connection

<!-- To create a websocket connection, we want to use the Deriv websocket URL with an `app_id`. You can create your own app_id within your [dashboard](/dashboard) or keep the default `1089` app_id for testing. Keep in mind that eventually, you should make your own app_id. Especially if you would like to monetize your application. -->

Next, we'll create a WebSocket connection to Deriv WebSocket Server as seen below:

```js title="index.js"
const app_id = 1089; // Replace with your app_id or leave as 1089 for testing.
const websocket = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const websocket = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
```

:::info
Expand Down Expand Up @@ -146,7 +147,7 @@ Your final code should be:

```js title="index.js"
const app_id = 1089; // Replace with your app_id or leave as 1089 for testing.
const websocket = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const websocket = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const ping_interval = 12000; // it's in milliseconds, which equals to 120 seconds
let interval;

Expand Down
2 changes: 1 addition & 1 deletion examples/active_symbols/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 1089; // Replace with your app_id or leave the current one for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });

// Currently gets all available symbols.
Expand Down
2 changes: 1 addition & 1 deletion examples/balance/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 32404; // Replace with your app_id or leave the current one for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });

// WARNING: Be careful to not leak your token here in the sandbox.
Expand Down
2 changes: 1 addition & 1 deletion examples/buy_contract/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 32436; // Replace with your app_id or leave the current test app_id.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });

// Use a demo account token to test with demo currency.
Expand Down
2 changes: 1 addition & 1 deletion examples/contracts_for_symbol/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 1089; // Replace with your app_id or leave the current test app_id.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });

const contracts_for_symbol_request = {
Expand Down
2 changes: 1 addition & 1 deletion examples/expired_contracts/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 32512; // Replace with your app_id or leave current one for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });

let token = '';
Expand Down
2 changes: 1 addition & 1 deletion examples/keep_alive/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 1089; // Replace with your app_id or leave as 1089 for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);

const api = new DerivAPIBasic({ connection });

Expand Down
2 changes: 1 addition & 1 deletion examples/open_contracts/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 32486; // Replace with your app_id for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });
// WARNING: Be careful to not leak your token here in the sandbox.
let token = '';
Expand Down
2 changes: 1 addition & 1 deletion examples/portfolio/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 32445; // Replace with your app_id or leave as 1089 for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });
// WARNING: Be careful to not leak your token here in the sandbox.
let token = '';
Expand Down
2 changes: 1 addition & 1 deletion examples/profit_table/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 32450; // Replace with your app_id or leave as 1089 for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });
// WARNING: Be careful to not leak your token here in the sandbox.
let token = '';
Expand Down
2 changes: 1 addition & 1 deletion examples/proposal/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 1089; // Replace with your app_id or leave as 1089 for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });

const proposal_request = {
Expand Down
2 changes: 1 addition & 1 deletion examples/statement/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 32462; // Replace with your app_id or leave as 1089 for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });
// WARNING: Be careful to not leak your token here in the sandbox.
let token = '';
Expand Down
2 changes: 1 addition & 1 deletion examples/ticks/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 1089; // Replace with your app_id or leave as 1089 for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });
const tickStream = () => api.subscribe({ ticks: 'R_100' });

Expand Down
2 changes: 1 addition & 1 deletion examples/ticks_history/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';

const app_id = 1089; // Replace with your app_id or leave as 1089 for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });

const ticks_history_request = {
Expand Down
2 changes: 1 addition & 1 deletion examples/website_status/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api';
const app_id = 1089; // Replace with your app_id or leave as 1089 for testing.
const connection = new WebSocket(`wss://ws.binaryws.com/websockets/v3?app_id=${app_id}`);
const connection = new WebSocket(`wss://red.binaryws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });

const websiteStatusResponse = async (res) => {
Expand Down