forked from microsoft/Quantum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHubs.cs
30 lines (25 loc) · 861 Bytes
/
Hubs.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Microsoft.AspNetCore.SignalR;
using System.Threading.Tasks;
namespace Microsoft.Quantum.Samples.StateVisualizer
{
/// <summary>
/// The hub recives receives events and commands from the web browser client and sends them to the state visualizer
/// server.
/// </summary>
internal class StateVisualizerHub : Hub
{
private readonly StateVisualizer visualizer;
public StateVisualizerHub(StateVisualizer visualizer)
{
this.visualizer = visualizer;
}
public override async Task OnConnectedAsync()
{
await visualizer.ReplayHistory(Clients.Caller);
await base.OnConnectedAsync();
}
public bool Advance() => visualizer.Advance();
}
}