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

Commit f23d2da

Browse files
Hubert KosterHubert Koster
authored andcommitted
chore: fixing content
1 parent 86710d3 commit f23d2da

File tree

6 files changed

+33
-34
lines changed

6 files changed

+33
-34
lines changed

docs/core-concepts/_category_.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"label": "Core Concepts",
2+
"label": "Core concepts",
33
"position": 2,
44
"link": {
55
"type": "generated-index",

docs/core-concepts/api-calls-anatomy/index.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: API calls' anatomy
3-
hide_title: true
3+
hide_title: false
44
draft: false
55
sidebar_label: API calls' anatomy
66
sidebar_position: 1
@@ -27,26 +27,26 @@ Some of these API calls automatically subscribe (e.g. [ticks](https://api.deriv.
2727

2828
For example, you can call [Tick History](https://api.deriv.com/api-explorer#ticks_history) to receive tick history data. But when you add the `subscribe` option to this call, you will receive the tick history data you requested in the first response, and you will continue to receive a new response every time there is a new tick published by the server for the given symbol.
2929

30-
In the message stream from `subscribe` there is a field called `subscription`, this is the `Stream ID`. with this ID you can identify the message stream in your logic and stop the stream with `Forget` and `Forget All` API calls.
30+
In the message stream from `subscribe`, there is a field called `subscription`. This is the `Stream ID`. With this ID, you can identify the message stream in your logic and stop the stream with `Forget` and `Forget All` API calls.
3131

3232
The data provided by API calls with the `subscribe` functionality can be used as a data source for other API calls and features.
3333

3434
### Send
3535

36-
If you call the API with the `send` functionality, then the server will only send back the requested data one time. In order to get updated data you have to send the API call again. Usually, this method is used when you get other API call responses or UI events such as `Click`, `Scroll` and more.
36+
If you call the API with the `send` functionality, then the server will only send back the requested data one time. In order to get updated data, you have to send the API call again. Usually, this method is used when you get other API call responses or UI events such as `Click`, `Scroll`, and more.
3737

3838
### Forget
3939

40-
If you want to stop the message Stream created by `subscribe`, you will have to call the `Forget` API call with the correct `Stream ID`. Otherwise, you can use the `Forget All` API call to stop streams by their `Method name`.
40+
If you want to stop the message stream created by `subscribe`, you will have to call the `Forget` API call with the correct `Stream ID`. Otherwise, you can use the `Forget All` API call to stop streams by their `Method name`.
4141

4242
:::caution
43-
For more information on the `Forget` API call, you can have a look at [Forget](https://api.deriv.com/api-explorer#forget) and [Forget All](https://api.deriv.com/api-explorer#forget_all) in the API explorer.
43+
For more information on the `Forget` API call, have a look at [Forget](https://api.deriv.com/api-explorer#forget) and [Forget All](https://api.deriv.com/api-explorer#forget_all) in the API explorer.
4444
:::
4545

4646

4747
## Request data
4848

49-
In order to make it easier for you to handle the `request` and `response` flow of your WebSocket connection, every deriv WebSocket API calls has a general structure. you can use it for caching, validation, request and response synchronization are some of the things you can use it for.
49+
To make it easier for you to handle the request and response flow of your WebSocket connection, each Deriv WebSocket API call follows a standardised structure. You can use it for caching, validation, request, and response synchronisation.
5050

5151
#### API call method name
5252

@@ -58,11 +58,11 @@ API Call Method Name is always required. this field determines the data you'll g
5858

5959
### Required fields
6060

61-
Every request data has several required fields which you must provide them and they may contain optional fields as well, let's explore this with an example on `Residence List`:
61+
Each request data has mandatory fields that you must provide, and it may also include optional fields. Let's explore this with an example from `Residence List`.
6262

63-
`Residence List` Call returns a list of countries and 2-letter country codes, suitable for populating the account opening form.
63+
A `Residence List` call returns a list of countries and 2-letter country codes, suitable for populating the account opening form.
6464

65-
Request data for this call is like so:
65+
The request data for this call is as below:
6666

6767
```ts
6868
{
@@ -72,19 +72,19 @@ Request data for this call is like so:
7272
}
7373
```
7474

75-
The `residence_list` field is the `method name` for the call and is required. There may be other required fields which are related to this type of the request you want to send. if you want to know more about `Residence List` and other API calls please check them out in the [API Explorer](https://api.deriv.com/api-explorer#residence_list).
75+
The `residence_list` field is the `method name` for the call and is required. There may be other required fields related to this type of the request you want to send. To know more about `Residence List` and other API calls, please check them out in [API Explorer](https://api.deriv.com/api-explorer#residence_list).
7676

7777
### Optional fields
7878

79-
Every Call has several `Optional` fields as well, `passthrough` and `req_id` are always part of the request data but you can choose to opt-out and not use them.
79+
Every call has several `Optional` fields as well. `Passthrough` and `req_id` are always part of the request data but you can choose to opt out and not use them.
8080

81-
#### `passthrough` field
81+
#### The `passthrough` field
8282

83-
Whatever you pass to this field will be returned back to you inside a `response` object, this can be helpful when you need to simulate a stateful flow for your `requests` and `responses`.
83+
Whatever you pass to this field will be returned back to you inside a `response` object. This can be helpful when you need to simulate a stateful flow for your `requests` and `responses`.
8484

85-
#### `req_id` field
85+
#### The `req_id` field
8686

87-
You may need to `tag` your requests and pass them through our `WebSocket` calls. you can do it by passing a `number` to this field. it can be helpful when you need to map `requests` to `responses`.
87+
You may need to `tag` your requests and pass them through our `WebSocket` calls. You can do so by passing a `number` to this field. it can be helpful when you need to map `requests` to `responses`.
8888

8989
:::caution
9090
To learn about additional optional fields specific to each API call, please refer to our [API Explorer](https://api.deriv.com/api-explorer).

docs/core-concepts/websocket/index.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ socket.onerror = function (error) {
7777
};
7878
```
7979

80-
## Why do we need websocket and when should we avoid it?
80+
## Why do we need WebSockets and when should we avoid them?
8181

8282
WebSocket are an essential client-server communication tool and one needs to be fully aware of its utility and avoid scenarios to benefit from its utmost potential. It’s explained extensively in the next section.
8383

@@ -95,25 +95,25 @@ WebSocket shouldn’t be taken onboard when old data fetching is the need of the
9595

9696
## WebSocket vs HTTP
9797

98-
As both HTTP and WebSocket are employed for application communication, people often get confused and find it difficult to pick one out of these two. Have a look at the below-mentioned text and gain better clarity on HTTP and WebSocket.
98+
As both HTTP and WebSocket protocols are employed for application communication, people often get confused and find it difficult to pick one.
9999

100-
As told previously, WebSocket is a framed and bidirectional protocol. On the contrary, to this, HTTP is a unidirectional protocol functioning above the TCP protocol.
100+
As told previously, WebSocket is a framed and bidirectional protocol. On the other hand, HTTP is a unidirectional protocol functioning above the TCP protocol.
101101

102-
As WebSocket protocol is capable to support continual data transmission, it’s majorly used in real-time application development. HTTP is stateless and is used for the development of [RESTful](https://de.wikipedia.org/wiki/Representational_State_Transfer) and [SOAP](https://de.wikipedia.org/wiki/SOAP) applications. Soap can still use HTTP for implementation, but REST is widely spread and used.
102+
As the WebSocket protocol is capable of supporting continual data transmission, it’s majorly used in real-time application development. HTTP is stateless and is used for the development of [RESTful](https://de.wikipedia.org/wiki/Representational_State_Transfer) and [SOAP](https://de.wikipedia.org/wiki/SOAP) applications. SOAP can still use HTTP for implementation, but REST is widely spread and used.
103103

104-
In WebSocket, communication occurs at both ends, which makes it a faster protocol. In HTTP, the connection is built at one end, making it a bit sluggish than WebSocket.
104+
In WebSocket, communication occurs at both ends, which makes it a faster protocol. In HTTP, the connection is built at one end, making it a bit more sluggish than WebSocket.
105105

106106
WebSocket uses a unified TCP connection and needs one party to terminate the connection. Until it happens, the connection remains active. HTTP needs to build a distinct connection for separate requests. Once the request is completed, the connection breaks automatically.
107107

108108
## How are WebSocket connections established?
109109

110-
The process starts with a WebSocket handshake that involves using a new scheme ws or wss. To understand quickly, you may consider them equivalent to HTTP and secure HTTP (HTTPS) respectively.
110+
The process starts with a WebSocket handshake that involves using a new scheme (ws or wss). To help you understand, consider them equivalent to HTTP and secure HTTP (HTTPS) respectively.
111111

112-
Using this scheme, servers and clients are expected to follow the standard WebSocket connection protocol. The WebSocket connection establishment begins with HTTP request upgrading that features a couple of headers such as Connection: Upgrade, Upgrade: WebSocket, Sec-WebSocket- Key, and so on.
112+
Using this scheme, servers and clients are expected to follow the standard WebSocket connection protocol. The WebSocket connection establishment begins with a HTTP request upgrading that features a couple of headers such as Connection: Upgrade, Upgrade: WebSocket, Sec-WebSocket- Key, and so on.
113113

114114
Here is how this connection is established:
115115

116-
1. **The Request :** Connection Upgrade header denotes the WebSocket handshake while the Sec-WebSocket-Key features Base64-encoded random value. This value is arbitrarily generated during every WebSocket handshake. Besides the above, the key header is also a part of this request.
116+
1. **The Request :** The Connection Upgrade header denotes the WebSocket handshake while the Sec-WebSocket-Key features Base64-encoded random value. This value is arbitrarily generated during every WebSocket handshake. Besides the above, the key header is also a part of this request.
117117

118118
The above-listed headers, when combined, form an HTTP GET request. It will have similar data in it:
119119

@@ -128,7 +128,7 @@ Sec-WebSocket-Version: 13
128128
Sec-WebSocket-Key: b6gjhT32u488lpuRwKaOWs==
129129
```
130130

131-
To clarify, Sec-WebSocket-Version, one can explain the WebSocket protocol version ready to use for the client.
131+
To clarify Sec-WebSocket-Version, one can explain the WebSocket protocol version ready to use for the client.
132132

133133
2. **The Response:** The response header, Sec-WebSocket-Accept, features the rest of value submitted in the Sec-WebSocket-Key request header. This is connected with a particular protocol specification and is used widely to keep misleading information at bay. In other words, it enhances the API security and stops ill-configured servers from creating blunders in the application development.
134134

docs/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ description: Getting started with Deriv API
2222

2323
Our Documentation is divided in several sections:
2424

25-
- [Core Concepts](category/core-concepts)
26-
- [Code Examples](category/code-examples)
25+
- [Core concepts](category/core-concepts)
26+
- [Code examples](category/code-examples)
2727
- [Languages](category/languages)
2828
- [Guides](category/guides)
2929
- [Setting up a deriv app](/docs/setting-up-a-deriv-application.md)

docs/languages/javascript/project-setup/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ Next, create the required files as you see below:
3030
touch index.html index.css index.js
3131
```
3232

33-
Now, you can open the folder with your prefered code editor or IDE.
34-
3533
:::tip
3634
We suggest using [Visual Studio Code](https://code.visualstudio.com/) with [Live Server Extension](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) enabled. This will help you a lot with implementations.
3735
:::
3836

39-
Your final code should be:
37+
Now open the `index.html` file or use the [Live Server Extension](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer)
38+
39+
Now, change the content of the files using the following approach:
4040

4141
```js title="index.js"
4242
console.log("we will create our websocket connection here");

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

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

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

21-
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.
22-
23-
To setup the connection, add the following code in your JavaScript file:
22+
Next, we'll create a WebSocket connection to Deriv WebSocket Server as seen below:
2423

2524
```js title="index.js"
2625
const app_id = 1089; // Replace with your app_id or leave as 1089 for testing.
@@ -72,7 +71,7 @@ Now, open the `index.html` file in our browser and check your developer console.
7271

7372
### Send and receive data
7473

75-
Our WebSocket server provides a [ping/pong](/api-explorer#ping) functionality. Let's use it in our demo project to send and receive data. Change the event listeners for `open` and `message` as below:
74+
Our WebSocket server provides [ping/pong](/api-explorer#ping) functionality. Let's use it in our demo project to send and receive data. Change the event listeners for `open` and `message` as below:
7675

7776
:::caution
7877
The `send` function on the WebSocket connection, only receives `string`, `ArrayBuffer`, `Blob`, `TypedArray` and `DataView`. You can read more about them on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send). This means, if we want to send an `object`, we have to stringify it with `JSON.stringify` first.

0 commit comments

Comments
 (0)