diff --git a/docs/docs/docs/01-core/data-transfer/00-intro.md b/docs/docs/docs/01-core/data-transfer/00-intro.md index 019f31cd40..387d4f7bed 100644 --- a/docs/docs/docs/01-core/data-transfer/00-intro.md +++ b/docs/docs/docs/01-core/data-transfer/00-intro.md @@ -15,3 +15,5 @@ import { useCurrentSidebarCategory } from '@docusaurus/theme-common'; ``` + +Note: The data-transfer package is written in Typescript and any additions or changes must include all necessary typings. diff --git a/docs/docs/docs/01-core/data-transfer/04-remote-strapi-providers/01-websocket.md b/docs/docs/docs/01-core/data-transfer/04-remote-strapi-providers/01-websocket.md index 49fc2d37ee..195ba25761 100644 --- a/docs/docs/docs/01-core/data-transfer/04-remote-strapi-providers/01-websocket.md +++ b/docs/docs/docs/01-core/data-transfer/04-remote-strapi-providers/01-websocket.md @@ -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