You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/stately-sky-getting-started.mdx
+18-15Lines changed: 18 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
title: 'Stately Sky getting started'
3
3
---
4
4
5
-
# Getting started with Stately Sky
5
+
# Getting started with Stately Sky 🌤️
6
6
7
-
This guide will walk you through deploying a simple traffic light state machine actor with Stately Sky using [XState](/docs/xstate.mdx), [Vite](https://vitejs.dev/) and [React](https://reactjs.org/).
7
+
This guide will walk you through deploying a simple traffic light state machine workflow with Stately Sky using [XState](/docs/xstate.mdx), [Vite](https://vitejs.dev/) and [React](https://reactjs.org/).
8
8
9
9
:::caution
10
10
@@ -40,7 +40,7 @@ Sky only supports [XState](https://github.com/statelyai/xstate) V5 machines. The
40
40
41
41
After creating your machine, you’ll need to create an API key to deploy it to Sky.
42
42
43
-
1. Use the **Run** button in the top right corner of the editor to open the Stately Sky options.
43
+
1. Use the **Deploy** button in the top right corner of the editor to open the Stately Sky options.
44
44
2. Use the **Create API Key** button to generate an API key.
45
45
46
46

@@ -53,13 +53,13 @@ The page should look like this:
53
53
54
54
## Step 3: Deploy your machine to Sky
55
55
56
-
Once you have generated the API key, you can deploy your machine to Sky as a running actor.
56
+
Once you have generated the API key, you can deploy your machine to Sky as a workflow.
57
57
58
-
1. Use the **Deploy new actor** button to start the deployment process.
59
-
2. When the actor is deployed, it will be listed under **Existing deploys**.
58
+
1. Use the **Deploy to Sky 🌤️** button to start the deployment process.
59
+
2. When the workflow is deployed, it will be listed under **Existing deploys**.
60
60
3. Use **Copy URL** to copy to the URL to your clipboard.
61
61
62
-
You’ll need the running actor’s URL to communicate with that actor from the starter project.
62
+
You’ll need the workflow’s URL to reference it from the starter project.
## Step 5: Initialize the actor in the starter project
83
+
## Step 5: Add the actor in the starter project
84
84
85
-
After adding the API key, you’ll need to initialize the actor.
85
+
After adding the API key, you’ll need to create an actor.
86
86
87
87
1. Create a new file in the `src` directory of the starter project. We named ours `trafficLightActor.ts`.
88
88
2. In your new file, import the `actorFromStately` function and initialize the actor with the provided URL and your own session ID:
@@ -91,20 +91,23 @@ After adding the API key, you’ll need to initialize the actor.
91
91
import { actorFromStately } from'@statelyai/sky';
92
92
93
93
const actor =actorFromStately({
94
-
url: 'paste your actor url here',
94
+
url: 'paste your Sky url here',
95
95
sessionId: 'your session id here',
96
96
});
97
97
```
98
98
99
-
The session ID can be any string you want. We recommend using a UUID.
100
-
101
99
:::tip
102
-
By default Sky is multiplayer. We use the session ID to allow multiple tenants to reference the same running actor instance.
100
+
By default, Sky is multiplayer.
101
+
The session ID is used to shard the multiplayer session. Each actor has a unique session ID.
102
+
103
+
- Use a shared session ID to allow multiple users to reference the same actor.
104
+
- If you want users isolated, use a unique session ID for each user.
105
+
103
106
:::
104
107
105
-
## Step 6: Fetching the actor config from Sky
108
+
## Step 6: Fetching the config from Sky
106
109
107
-
Now that we’ve initialized the actor, we need to fetch the config from Sky. Doing so will download and generate the machine configuration file in our repo, giving us type safety when interacting with the running actor!
110
+
Now that we’ve created the actor, we need to fetch the config from Sky. Doing so will download and generate the machine configuration file in our repo, giving us type safety when interacting with the running actor!
108
111
109
112
To fetch the config, we’ll use the [XState CLI tool](/docs/developer-tools.mdx#xstate-cli-command-line-interface) and the `sky` script already in our `package.json`. This script runs the command over all the files in the `src` repo to find configs associated with any initialized actors.
0 commit comments