mirror of
https://github.com/strapi/strapi.git
synced 2025-10-28 16:39:37 +00:00
websocket docs
This commit is contained in:
parent
e7e225ba5f
commit
cb4126a9e8
@ -15,3 +15,5 @@ import { useCurrentSidebarCategory } from '@docusaurus/theme-common';
|
||||
|
||||
<DocCardList items={useCurrentSidebarCategory().items} />
|
||||
```
|
||||
|
||||
Note: The data-transfer package is written in Typescript and any additions or changes must include all necessary typings.
|
||||
|
||||
@ -14,23 +14,45 @@ Opening a websocket connection on those routes requires a valid transfer token a
|
||||
|
||||
Please see the `bootstrap()` method of the remote providers for an example of how to make the initial connection to the Strapi websocket.
|
||||
|
||||
## Websocket Messages
|
||||
## Websocket Messages / Dispatcher
|
||||
|
||||
After connecting to the websocket.
|
||||
The remote websocket server only accepts specific websocket messages which we call transfer commands. These commands must also be sent in a specific order, and an error messages will be returned if an unexpected message is received by the server.
|
||||
|
||||
### Initialization Messages
|
||||
A message dispatcher object should be created to send messages to the server. See `packages/core/data-transfer/src/strapi/providers/utils.ts` for more inofrmation on the dispatcher.
|
||||
|
||||
** TODO **
|
||||
The dispatcher includes
|
||||
|
||||
### Pull Messages
|
||||
### dispatchCommand
|
||||
|
||||
** TODO **
|
||||
Accepts "commands" used for opening and closing a transfer.
|
||||
|
||||
### Push Messages
|
||||
Allows the following `command` values:
|
||||
|
||||
** TODO **
|
||||
- `init`: for initializing a connection. Returns a transferID that must be sent with all future messages in this transfer
|
||||
- `end`: for ending a connection
|
||||
|
||||
See `packages/core/data-transfer/dist/strapi/remote/handlers/push.d.ts` and `packages/core/data-transfer/dist/strapi/remote/handlers/push.d.ts`
|
||||
### dispatchTransferStep
|
||||
|
||||
Used for switching between stages of a transfer and streaming the actual data of a transfer.
|
||||
|
||||
Accepts the following `action` values:
|
||||
|
||||
- `start`: sent with a `step` value for the name of the step/stage
|
||||
- any number of `stream`: sent with a `step` value and the `data` being sent (ie, an entity)
|
||||
- `end`: sent with a `step` value for the step being ended
|
||||
|
||||
### dispatchTransferAction
|
||||
|
||||
Used for triggering 'actions' on the server equivalent to the local providers.
|
||||
|
||||
- `bootstrap`
|
||||
- `getMetadata`
|
||||
- `beforeTransfer`
|
||||
- `getSchemas`
|
||||
- `rollback` (destination only)
|
||||
- `close`: for completing a transfer (but doesn't close the connection)
|
||||
|
||||
See `packages/core/data-transfer/dist/strapi/remote/handlers/push.d.ts` and `packages/core/data-transfer/dist/strapi/remote/handlers/push.d.ts` for complete and precise definitions of the messages that must be sent.
|
||||
|
||||
## Message Timeouts and Retries
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user