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
{{ message }}
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
[ package:dds ] Add server-sent event (SSE) support to DDS
This support is required for web clients of dwds within google3
Change-Id: Ia1ecbf8f5ba79d53cb340c83a579dc0810ec0065
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150183
Reviewed-by: Gary Roumanis <grouma@google.com>
Copy file name to clipboardExpand all lines: pkg/dds/README.md
+29-1Lines changed: 29 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,35 @@ A package used to spawn the Dart Developer Service (DDS), which is used to commu
2
2
3
3
# Functionality
4
4
5
-
Existing VM Service clients can issue both HTTP and websocket requests to a running DDS instance as if it were an instance of the VM Service itself. If a request corresponds to an RPC defined in the [VM Service Protocol][service-protocol], DDS will forward the request and return the response from the VM Service. Requests corresponding to an RPC defined in the [DDS Protocol][dds-protocol] will be handled directly by the DDS instance.
5
+
Existing VM Service clients can issue both HTTP, websocket, and SSE requests to a running DDS instance as if it were an instance of the VM Service itself. If a request corresponds to an RPC defined in the [VM Service Protocol][service-protocol], DDS will forward the request and return the response from the VM Service. Requests corresponding to an RPC defined in the [DDS Protocol][dds-protocol] will be handled directly by the DDS instance.
6
+
7
+
# SSE Support
8
+
9
+
For certain web clients it may be preferrable or required to communicate with DDS using server-sent events (SSE). DDS has a SSE handler listening for requests on `/$debugHandler`.
10
+
11
+
## SSE and package:vm_service example
12
+
13
+
```dart
14
+
import 'package:sse/sse.dart';
15
+
import 'package:vm_service/vm_service.dart';
16
+
17
+
void main() {
18
+
// Establish connection with DDS using SSE.
19
+
final ddsChannel = SseClient('${ddsUri}\$debugHandler');
20
+
21
+
// Wait for ddsChannel to be established
22
+
await ddsChannel.onOpen.first;
23
+
24
+
// Initialize VmService using the sink and stream from ddsChannel.
0 commit comments