Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit d3be49a

Browse files
authored
Merge pull request #196 from mohsen-deriv/uppdate-ws-connection
2 parents b340722 + fb92551 commit d3be49a

File tree

18 files changed

+27
-19
lines changed

18 files changed

+27
-19
lines changed

docs/core-concepts/websocket/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ WebSocket is especially great for services that require continuous data exchange
2525
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`:
2626

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

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

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

5454
socket.onopen = function (e) {
5555
console.log('[open] Connection established');

docs/intro.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ keywords:
1616
description: Getting started with Deriv API
1717
---
1818

19+
:::danger
20+
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
21+
`red.binaryws.com`.
22+
This restriction will be applied after 7 days and any traffic to the other servers from third-party apps will be rejected.
23+
Please take the necessary action before the effective date.
24+
:::
25+
1926
Our Documentation is divided in several sections:
2027

2128
- [Core concepts](category/core-concepts)

docs/languages/javascript/get-country-list/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Your final code will be:
145145

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

docs/languages/javascript/websocket-connection/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ If you're not familiar with WebSockets, please check out [our documentation](/do
1717
:::
1818

1919
### Set up a WebSocket connection
20+
2021
<!-- 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. -->
2122

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

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

2930
:::info
@@ -146,7 +147,7 @@ Your final code should be:
146147

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

examples/active_symbols/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';
22

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

77
// Currently gets all available symbols.

examples/balance/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';
22

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

77
// WARNING: Be careful to not leak your token here in the sandbox.

examples/buy_contract/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';
22

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

77
// Use a demo account token to test with demo currency.

examples/contracts_for_symbol/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';
22

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

77
const contracts_for_symbol_request = {

examples/expired_contracts/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';
22

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

77
let token = '';

examples/keep_alive/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import DerivAPIBasic from 'https://cdn.skypack.dev/@deriv/deriv-api/dist/DerivAPIBasic';
22

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

66
const api = new DerivAPIBasic({ connection });
77

0 commit comments

Comments
 (0)