@@ -10,6 +10,10 @@ application instances of the same project if necessary.
10
10
11
11
To start using it, install the Dart Frog CLI and run the ` dart_frog daemon ` command. Once running, communicating with it can be done via [ JSON-RPC] ( https://www.jsonrpc.org/ ) over stdin/stdout to receive and send messages.
12
12
13
+ ::: note
14
+ For a concrete sample of how to interact with the daemon via ` stdio ` , see the [ end-to-end tests] ( https://github.com/VeryGoodOpenSource/dart_frog/tree/main/packages/dart_frog_cli/e2e/test/daemon ) .
15
+ :::
16
+
13
17
There are three types of messages:
14
18
15
19
- ** Request** : A request is a message sent by a client to the daemon. The daemon will process the
@@ -21,6 +25,10 @@ There are three types of messages:
21
25
Every request should be met with a response as soon as possible so the caller can work with
22
26
timeouts. The daemon will send events to the client as they happen.
23
27
28
+ ::: warning
29
+ The daemon is still in its early stages of development. Therefore, the API is not stable and may change.
30
+ :::
31
+
24
32
---
25
33
26
34
#### Usage example
@@ -69,6 +77,19 @@ Request the daemon version.
69
77
| ------- | ------ | ------------------ |
70
78
| version | string | The daemon version |
71
79
80
+ ``` sh
81
+ $ dart_frog daemon
82
+
83
+ // ready event sent via stdout
84
+ [{" event" :" daemon.ready" ," params" :{" version" :" 0.0.1" ," processId" :75941}}]
85
+
86
+ // request inserted via stdin
87
+ [{" method" : " daemon.requestVersion" , " id" : " 12" }]
88
+
89
+ // response sent via stdout
90
+ [{" id" :" 12" ," result" :{" version" :" 0.0.1" }}]
91
+ ```
92
+
72
93
### Method: ` kill `
73
94
74
95
Shuts down the daemon
@@ -79,6 +100,19 @@ Shuts down the daemon
79
100
| ------- | ------ | ----------------- |
80
101
| message | string | A goodbye message |
81
102
103
+ ``` sh
104
+ $ dart_frog daemon
105
+
106
+ // ready event sent via stdout
107
+ [{" event" :" daemon.ready" ," params" :{" version" :" 0.0.1" ," processId" :75941}}]
108
+
109
+ // request inserted via stdin
110
+ [{" method" : " daemon.kill" , " id" : " 12" }]
111
+
112
+ // response sent via stdout
113
+ [{" id" :" 12" ," result" :{" message" :" Hogarth. You stay, I go. No following." }}]
114
+ ```
115
+
82
116
### Event: ` ready `
83
117
84
118
Signals that a daemon is ready right after startup
@@ -112,6 +146,21 @@ Start a dev server on a given project.
112
146
| ------------- | ------ | ----------------------------------------------- |
113
147
| applicationId | String | A unique identifier for the dev server instance |
114
148
149
+ ``` sh
150
+ $ dart_frog daemon
151
+
152
+ // ready event sent via stdout
153
+ [{" event" :" daemon.ready" ," params" :{" version" :" 0.0.1" ," processId" :75941}}]
154
+
155
+ // request inserted via stdin
156
+ [{" method" :" dev_server.start" ," id" :" 12" ," params" :{" workingDirectory" :" ./" ," port" :8080," dartVmServicePort" :8091}}]
157
+
158
+ // response sent via stdout
159
+ [{" event" :" dev_server.applicationStarting" ," params" :{" applicationId" :" 9e531349" ," requestId" :" 12" }}]
160
+
161
+ // Few logs omitted
162
+ ```
163
+
115
164
### Method: ` reload `
116
165
117
166
Reload a running dev server.
@@ -128,6 +177,25 @@ Reload a running dev server.
128
177
| ------------- | ------ | ----------------------------------------------- |
129
178
| applicationId | String | A unique identifier for the dev server instance |
130
179
180
+ ``` sh
181
+ $ dart_frog daemon
182
+
183
+ // ready event sent via stdout
184
+ [{" event" :" daemon.ready" ," params" :{" version" :" 0.0.1" ," processId" :75941}}]
185
+
186
+ // start server before reloading (use dev_server.start)
187
+
188
+ // request inserted via stdin
189
+ [{" method" :" dev_server.reload" ," id" :" 12" ," params" :{" applicationId" :" 9e531349" }}]
190
+
191
+ // Few logs omitted
192
+
193
+ // response sent via stdout
194
+ [{" id" :" 12" ," result" :{" applicationId" :" 9e531349" }}]
195
+
196
+ // Few logs omitted
197
+ ```
198
+
131
199
### Method: ` stop `
132
200
133
201
Stop a running dev server.
@@ -145,6 +213,23 @@ Stop a running dev server.
145
213
| applicationId | String | A unique identifier for the dev server instance |
146
214
| exitCode | int | The exit code of the dev server process |
147
215
216
+ ``` sh
217
+ $ dart_frog daemon
218
+
219
+ // ready event sent via stdout
220
+ [{" event" :" daemon.ready" ," params" :{" version" :" 0.0.1" ," processId" :75941}}]
221
+
222
+ // start server before stopping (use dev_server.start)
223
+
224
+ // request inserted via stdin
225
+ [{" method" :" dev_server.stop" ," id" :" 12" ," params" :{" applicationId" :" 9e531349" }}]
226
+
227
+ // Few logs omitted
228
+
229
+ // response sent via stdout
230
+ [{" id" :" 12" ," result" :{" applicationId" :" 9e531349" ," exitCode" :0}}]
231
+ ```
232
+
148
233
### Event: ` applicationStarting `
149
234
150
235
Signals that a dev server is starting.
@@ -207,6 +292,22 @@ when the route configuration of a project changes.
207
292
| --------- | ------ | -------------------------------------------- |
208
293
| watcherId | String | A unique identifier for the watcher instance |
209
294
295
+ ``` sh
296
+ $ dart_frog daemon
297
+
298
+ // ready event sent via stdout
299
+ [{" event" :" daemon.ready" ," params" :{" version" :" 0.0.1" ," processId" :75941}}]
300
+
301
+ // request inserted via stdin
302
+ [{" method" :" route_configuration.watcherStart" ," id" :" 12" ," params" :{" workingDirectory" :" ./" }}]
303
+
304
+ // response sent via stdout
305
+ [{" id" :" 12" ," result" :{" watcherId" :" 29f9ad21" }}]
306
+
307
+ // An event is sent via stdout for every change detected
308
+ [{" event" :" route_configuration.changed" ," params" :{" watcherId" :" 29f9ad21" ," requestId" :" 12" ," routeConfiguration" :{ ... }}}]
309
+ ```
310
+
210
311
### Method: ` watcherStop `
211
312
212
313
Stops a route configuration watcher created by ` watcherStart ` .
@@ -224,6 +325,23 @@ Stops a route configuration watcher created by `watcherStart`.
224
325
| watcherId | String | A unique identifier for the watcher instance |
225
326
| exitCode | int | The exit code of the watcher process |
226
327
328
+ ``` sh
329
+ $ dart_frog daemon
330
+
331
+ // ready event sent via stdout
332
+ [{" event" :" daemon.ready" ," params" :{" version" :" 0.0.1" ," processId" :75941}}]
333
+
334
+ // start watcher before stopping (use route_configuration.watcherStart)
335
+
336
+ // request inserted via stdin
337
+ [{" method" :" route_configuration.watcherStop" ," id" :" 12" ," params" :{" watcherId" :" 29f9ad21" }}]
338
+
339
+ // Few logs omitted
340
+
341
+ // response sent via stdout
342
+ [{" id" :" 12" ," result" :{" watcherId" :" 29f9ad21" ," exitCode" :0}}]
343
+ ```
344
+
227
345
### Method: ` watcherGenerateRouteConfiguration `
228
346
229
347
Forces a route configuration watcher to generate a route configuration for a given project.
@@ -242,6 +360,23 @@ Also, returns the generated route configuration.
242
360
| watcherId | String | A unique identifier for the watcher instance |
243
361
| routeConfiguration | String | The generated route configuration |
244
362
363
+ ``` sh
364
+ $ dart_frog daemon
365
+
366
+ // ready event sent via stdout
367
+ [{" event" :" daemon.ready" ," params" :{" version" :" 0.0.1" ," processId" :75941}}]
368
+
369
+ // start watcher before stopping (use route_configuration.watcherStart)
370
+
371
+ // request inserted via stdin
372
+ [{" method" :" route_configuration.watcherGenerateRouteConfiguration" ," id" :" 12" ," params" :{" watcherId" :" 29f9ad21" }}]
373
+
374
+ // Few logs omitted
375
+
376
+ // response sent via stdout
377
+ [{" id" :" 12" ," result" :{" watcherId" :" 29f9ad21" ," routeConfiguration" :{ ... }}}]
378
+ ```
379
+
245
380
### Event: ` changed `
246
381
247
382
Signals that the route configuration of a project has changed.
0 commit comments