-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
43 lines (39 loc) · 1.34 KB
/
Program.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
31
32
33
34
35
36
37
38
39
40
41
42
43
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Realtime_Dashboard_Example.Consumers;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Realtime_Dashboard_Example
{
public class Program
{
public static void Main(string[] args)
{
Task.Run(() => PrepareConsumer("phone", new List<string>() { "DashboardExample" }));
CreateWebHostBuilder(args).Build().Run();
}
public static void PrepareConsumer(string type, List<string> contexts)
{
switch (type)
{
case "phone":
var pc = new PhoneConsumer
{
Project = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
Token = "PTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
Contexts = contexts
};
pc.RealTimeEvent += Pc_RealTimeEvent;
pc.Run();
break;
}
}
private static void Pc_RealTimeEvent(object sender, Helpers.RealTimeEventArgs e)
{
Helpers.data.Enqueue(e);
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}