startLiveReloadWebSocketServer function
Starts a WebSocket server which will send a reloadSignal to all of its clients when succeededBuild
emits.
If you want to take control over the WebSocketChannel
, consider using startWebSocketServer.
Implementation
void startLiveReloadWebSocketServer(Uri uri, Stream<Null> succeededBuild) {
succeededBuild = succeededBuild.asBroadcastStream();
startWebSocketServer(uri).listen((channel) {
succeededBuild.first.then((_) {
channel.sink.add(reloadSignal);
channel.sink.close();
});
});
}