Skip to content

Commit 9002860

Browse files
authored
refactor for websocket guide (#17)
1 parent 3d3d11e commit 9002860

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/websocket-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ While Websockets support multi-user sessions, this documentation is mainly focus
2323

2424
## Why Websockets?
2525

26-
Web applications sessions are not persistent. You can maintain state at the back- _or_ frontend, but not both simultaneously. It's great that `Nuxt Pinia` allows your browser to store what you've been doing, but that will need to be communicated via your API to the backend on every page change.
26+
Web applications sessions are not persistent. You can maintain state at the back- _or_ frontend, but not both simultaneously. It's great that `React Redux` allows your browser to store what you've been doing, but that will need to be communicated via your API to the backend on every page change.
2727

2828
There are ways around this, such as automatically polling the API (known as [long polling](https://ably.com/topic/long-polling)), but Websockets create a bidirectional session between the front- and backends, allowing you to run a synchronous interactive process.
2929

@@ -42,7 +42,7 @@ The following general conditions apply:
4242

4343
Here's how the workflow tends to play out:
4444

45-
- `frontend` - initialise a socket by opening a session and sending an initial payload `request`, which may include a user token (if authentication is required).
45+
- `frontend` - initialize a socket by opening a session and sending an initial payload `request`, which may include a user token (if authentication is required).
4646
- `backend` - receive a socket `request`, validate the session (user or other), send a `response` to the `frontend`, and then enter a `while True` loop to keep the session open and keep listening for `requests`.
4747
- `frontend` - each `response` triggers an event, updating the view.
4848
- `frontend` - send an instruction to close the socket when the user ends the sessions or, as fallback, when the user changes the page.
@@ -64,7 +64,7 @@ pip install websockets
6464
yarn install websocket-as-promised
6565
```
6666

67-
## Setting up the Nuxt `frontend`
67+
## Setting up the React `frontend`
6868

6969
The API `backend` is reached at `ws://localhost/api/v1` (or `wss://<your-domain>/api/v1` in production).
7070

0 commit comments

Comments
 (0)