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

Commit

Permalink
Merge pull request #242 from hubert-deriv/update_sandbox_endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
hubert-deriv authored Aug 24, 2023
2 parents 54c3e88 + 9fa154b commit ab1484d
Show file tree
Hide file tree
Showing 19 changed files with 24 additions and 24 deletions.
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://ws.derivws.com/websockets/v3?app_id=1089');
```

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

```js showLineNumbers
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://ws.derivws.com/websockets/v3?app_id=${app_id}`);

socket.onopen = function (e) {
console.log('[open] Connection established');
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" showLineNumbers
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://ws.derivws.com/websockets/v3?app_id=${app_id}`);
const ping_interval = 12000; // it's in milliseconds, which equals to 120 seconds
let interval;

Expand Down
4 changes: 2 additions & 2 deletions docs/languages/javascript/websocket-connection/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Next, we'll create a WebSocket connection to Deriv WebSocket Server as seen belo

```js title="index.js" showLineNumbers
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://ws.derivws.com/websockets/v3?app_id=${app_id}`);
```

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

```js title="index.js" showLineNumbers
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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.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://ws.derivws.com/websockets/v3?app_id=${app_id}`);
const api = new DerivAPIBasic({ connection });

const websiteStatusResponse = async (res) => {
Expand Down
2 changes: 1 addition & 1 deletion src/features/Endpoint/Endpoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const EndPoint = () => {
},
})}
name='server_url'
placeholder='e.g. frontend.binaryws.com'
placeholder='e.g. ws.binaryws.com'
className={styles.textInput}
required
/>
Expand Down
8 changes: 4 additions & 4 deletions src/features/Endpoint/__tests__/Endpoint.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Endpoint', () => {
});

it('should have default values in input fields', () => {
const server = screen.getByPlaceholderText('e.g. frontend.binaryws.com');
const server = screen.getByPlaceholderText('e.g. ws.binaryws.com');
const app_id = screen.getByPlaceholderText('e.g. 9999');
expect(server).toHaveValue('oauth.deriv.com');

Expand All @@ -40,7 +40,7 @@ describe('Endpoint', () => {
});

it('validate user inputs, and provides error messages for server field', async () => {
const server = screen.getByPlaceholderText('e.g. frontend.binaryws.com');
const server = screen.getByPlaceholderText('e.g. ws.binaryws.com');

await userEvent.clear(server);
await userEvent.type(server, '[email protected]');
Expand All @@ -51,7 +51,7 @@ describe('Endpoint', () => {
});

it('should validate submit button functionality', async () => {
const server = screen.getByPlaceholderText('e.g. frontend.binaryws.com');
const server = screen.getByPlaceholderText('e.g. ws.binaryws.com');
const app_id = screen.getByPlaceholderText('e.g. 9999');
const form = screen.getByRole('form');

Expand Down Expand Up @@ -89,7 +89,7 @@ describe('Endpoint', () => {
});

it('Should have submit button enabled with no errors on the from', async () => {
const server = screen.getByPlaceholderText('e.g. frontend.binaryws.com');
const server = screen.getByPlaceholderText('e.g. ws.binaryws.com');
const app_id = screen.getByPlaceholderText('e.g. 9999');
const submit_button = screen.getByRole('button', { name: /submit/i });

Expand Down

1 comment on commit ab1484d

@vercel
Copy link

@vercel vercel bot commented on ab1484d Aug 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-api-docs – ./

deriv-api-docs.binary.sx
deriv-api-docs-git-master.binary.sx

Please sign in to comment.