energyManagementV3SignalRHubProvider top-level property
final
Provider that connects to a SignalR Hub with the provided path using the Energy Management V3 API
Implementation
final energyManagementV3SignalRHubProvider =
FutureProvider.autoDispose.family((ref, String path) async {
return HubConnectionBuilder()
.withUrl(
Uri.parse(await ref.watch(_cleanEnergyRdc2UrlProvider.future))
.replace(path: path)
.toString(),
options: HttpConnectionOptions(
requestTimeout: 10000,
accessTokenFactory: ref.watch(isLoggedInProvider)
? await ref.watch(authManagerProvider.future).then(
(authManager) =>
() => authManager.getAuthHeader().then(getAuthToken),
)
: null,
),
)
.build();
});