Price reminder and init approval
* Start price reminder grain * Add config and init grain at startup * Save init wallet when already init
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
using Managing.Application.Abstractions.Services;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
|
||||
namespace Managing.Application.Hubs;
|
||||
|
||||
public class CandleHub : Hub
|
||||
{
|
||||
private int ConnectionCount = 0;
|
||||
private readonly IStreamService _streamService;
|
||||
|
||||
public CandleHub(IStreamService streamService)
|
||||
{
|
||||
_streamService = streamService;
|
||||
}
|
||||
|
||||
public async override Task OnConnectedAsync()
|
||||
{
|
||||
ConnectionCount++;
|
||||
|
||||
await Clients.Caller.SendAsync("Message", $"Connected successfully on candle hub. ConnectionId : {Context.ConnectionId}");
|
||||
|
||||
//await _streamService.SubscribeCandle(async (candle) => {
|
||||
// await Clients.All.SendAsync("Candle", candle);
|
||||
//});
|
||||
await _streamService.SubscribeCandle();
|
||||
await base.OnConnectedAsync();
|
||||
|
||||
}
|
||||
|
||||
public override async Task OnDisconnectedAsync(Exception ex)
|
||||
{
|
||||
await Clients.Caller.SendAsync("Message", $"Shuting down candle hub. ConnectionId : {Context.ConnectionId}");
|
||||
|
||||
ConnectionCount--;
|
||||
if(ConnectionCount == 0)
|
||||
{
|
||||
await _streamService.UnSubscribeCandle();
|
||||
}
|
||||
await base.OnDisconnectedAsync(ex);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user