HtmlSseClient.connect constructor
HtmlSseClient.connect(
- Uri uri, {
- bool withCredentials = false,
})
Implementation
factory HtmlSseClient.connect(Uri uri, {bool withCredentials = false}) {
final incomingController = StreamController<String?>();
final eventSource =
EventSource(uri.toString(), withCredentials: withCredentials);
eventSource.addEventListener('message', (Event message) {
incomingController.add((message as MessageEvent).data as String?);
});
return HtmlSseClient(incomingController.stream);
}