From 5f163453f8f65b28a820c55c3f8b7faa067763d6 Mon Sep 17 00:00:00 2001 From: Hubert Koster Date: Thu, 24 Aug 2023 11:55:03 +0200 Subject: [PATCH 1/3] chore: changing binaryws to derivws --- docs/core-concepts/websocket/index.md | 4 ++-- docs/languages/javascript/get-country-list/index.md | 2 +- docs/languages/javascript/websocket-connection/index.md | 4 ++-- examples/active_symbols/index.js | 2 +- examples/balance/index.js | 2 +- examples/buy_contract/index.js | 2 +- examples/contracts_for_symbol/index.js | 2 +- examples/expired_contracts/index.js | 2 +- examples/keep_alive/index.js | 2 +- examples/open_contracts/index.js | 2 +- examples/portfolio/index.js | 2 +- examples/profit_table/index.js | 2 +- examples/proposal/index.js | 2 +- examples/statement/index.js | 2 +- examples/ticks/index.js | 2 +- examples/ticks_history/index.js | 2 +- examples/website_status/index.js | 2 +- src/features/Endpoint/Endpoint.tsx | 2 +- src/utils/constants.ts | 2 +- 19 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/core-concepts/websocket/index.md b/docs/core-concepts/websocket/index.md index 6162cdc00..f6a267787 100644 --- a/docs/core-concepts/websocket/index.md +++ b/docs/core-concepts/websocket/index.md @@ -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 @@ -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'); diff --git a/docs/languages/javascript/get-country-list/index.md b/docs/languages/javascript/get-country-list/index.md index 7e2beee8e..2f90619dd 100644 --- a/docs/languages/javascript/get-country-list/index.md +++ b/docs/languages/javascript/get-country-list/index.md @@ -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; diff --git a/docs/languages/javascript/websocket-connection/index.md b/docs/languages/javascript/websocket-connection/index.md index 5bd36651e..6077cedb8 100644 --- a/docs/languages/javascript/websocket-connection/index.md +++ b/docs/languages/javascript/websocket-connection/index.md @@ -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 @@ -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; diff --git a/examples/active_symbols/index.js b/examples/active_symbols/index.js index 4a3492003..8effda294 100644 --- a/examples/active_symbols/index.js +++ b/examples/active_symbols/index.js @@ -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. diff --git a/examples/balance/index.js b/examples/balance/index.js index 5b2d54744..fbcb827cb 100644 --- a/examples/balance/index.js +++ b/examples/balance/index.js @@ -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. diff --git a/examples/buy_contract/index.js b/examples/buy_contract/index.js index d245faf8e..767e19252 100644 --- a/examples/buy_contract/index.js +++ b/examples/buy_contract/index.js @@ -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. diff --git a/examples/contracts_for_symbol/index.js b/examples/contracts_for_symbol/index.js index 2794c84bb..b1abe44d8 100644 --- a/examples/contracts_for_symbol/index.js +++ b/examples/contracts_for_symbol/index.js @@ -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 = { diff --git a/examples/expired_contracts/index.js b/examples/expired_contracts/index.js index b537a2a44..6933eb885 100644 --- a/examples/expired_contracts/index.js +++ b/examples/expired_contracts/index.js @@ -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 = ''; diff --git a/examples/keep_alive/index.js b/examples/keep_alive/index.js index 2bdc43950..e3f498810 100644 --- a/examples/keep_alive/index.js +++ b/examples/keep_alive/index.js @@ -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 }); diff --git a/examples/open_contracts/index.js b/examples/open_contracts/index.js index 6caa8d1f2..11df69c02 100644 --- a/examples/open_contracts/index.js +++ b/examples/open_contracts/index.js @@ -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 = ''; diff --git a/examples/portfolio/index.js b/examples/portfolio/index.js index e8514b1da..c7d4bfcdc 100644 --- a/examples/portfolio/index.js +++ b/examples/portfolio/index.js @@ -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 = ''; diff --git a/examples/profit_table/index.js b/examples/profit_table/index.js index 23376b7bc..bfcbc334a 100644 --- a/examples/profit_table/index.js +++ b/examples/profit_table/index.js @@ -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 = ''; diff --git a/examples/proposal/index.js b/examples/proposal/index.js index 8aeb5c603..98f5fc419 100644 --- a/examples/proposal/index.js +++ b/examples/proposal/index.js @@ -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 = { diff --git a/examples/statement/index.js b/examples/statement/index.js index 3b82b58bd..6f1889b39 100644 --- a/examples/statement/index.js +++ b/examples/statement/index.js @@ -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 = ''; diff --git a/examples/ticks/index.js b/examples/ticks/index.js index f57cf7778..3ac150902 100644 --- a/examples/ticks/index.js +++ b/examples/ticks/index.js @@ -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' }); diff --git a/examples/ticks_history/index.js b/examples/ticks_history/index.js index 6ebc51d46..8876aca07 100644 --- a/examples/ticks_history/index.js +++ b/examples/ticks_history/index.js @@ -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 = { diff --git a/examples/website_status/index.js b/examples/website_status/index.js index b9a086e0c..582fa0b6a 100644 --- a/examples/website_status/index.js +++ b/examples/website_status/index.js @@ -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) => { diff --git a/src/features/Endpoint/Endpoint.tsx b/src/features/Endpoint/Endpoint.tsx index 23d82bc0e..9c999ab80 100644 --- a/src/features/Endpoint/Endpoint.tsx +++ b/src/features/Endpoint/Endpoint.tsx @@ -67,7 +67,7 @@ const EndPoint = () => { }, })} name='server_url' - placeholder='e.g. frontend.binaryws.com' + placeholder='e.g. ws.derivws.com' className={styles.textInput} required /> diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 95141c566..7059e498d 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -2,7 +2,7 @@ export const PRODUCTION_APP_ID = '36544'; export const STAGING_APP_ID = '36545'; export const VERCEL_DEPLOYMENT_APP_ID = '35073'; export const LOCALHOST_APP_ID = '35074'; -export const DEFAULT_WS_SERVER = 'ws.binaryws.com'; +export const DEFAULT_WS_SERVER = 'ws.derivws.com'; export const OAUTH_URL = 'oauth.deriv.com'; export const LOGIN_ACCOUNTS_SESSION_STORAGE_KEY = 'login-accounts'; From bc80b6a0cd35a7caa73b165072cc7321cc5ed409 Mon Sep 17 00:00:00 2001 From: Hubert Koster Date: Thu, 24 Aug 2023 12:04:31 +0200 Subject: [PATCH 2/3] chore: reverting some changes --- src/features/Endpoint/Endpoint.tsx | 2 +- src/utils/constants.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/features/Endpoint/Endpoint.tsx b/src/features/Endpoint/Endpoint.tsx index 9c999ab80..1cd7a03a3 100644 --- a/src/features/Endpoint/Endpoint.tsx +++ b/src/features/Endpoint/Endpoint.tsx @@ -67,7 +67,7 @@ const EndPoint = () => { }, })} name='server_url' - placeholder='e.g. ws.derivws.com' + placeholder='e.g. ws.binaryws.com' className={styles.textInput} required /> diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 7059e498d..95141c566 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -2,7 +2,7 @@ export const PRODUCTION_APP_ID = '36544'; export const STAGING_APP_ID = '36545'; export const VERCEL_DEPLOYMENT_APP_ID = '35073'; export const LOCALHOST_APP_ID = '35074'; -export const DEFAULT_WS_SERVER = 'ws.derivws.com'; +export const DEFAULT_WS_SERVER = 'ws.binaryws.com'; export const OAUTH_URL = 'oauth.deriv.com'; export const LOGIN_ACCOUNTS_SESSION_STORAGE_KEY = 'login-accounts'; From 9fa154b22e09f396fa6b4b8e745cb2c479cb32ac Mon Sep 17 00:00:00 2001 From: Hubert Koster Date: Thu, 24 Aug 2023 12:37:02 +0200 Subject: [PATCH 3/3] chore: fixing test --- src/features/Endpoint/__tests__/Endpoint.test.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/features/Endpoint/__tests__/Endpoint.test.tsx b/src/features/Endpoint/__tests__/Endpoint.test.tsx index 47cd2fa74..94bde8313 100644 --- a/src/features/Endpoint/__tests__/Endpoint.test.tsx +++ b/src/features/Endpoint/__tests__/Endpoint.test.tsx @@ -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'); @@ -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, 'qa10@deriv.com'); @@ -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'); @@ -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 });