public async Task SendMessage(string message) { var userId = NameUserIdProvider.GetUserId(Context); if (userId != null) { var command = Newtonsoft.Json.JsonConvert.DeserializeObject <AckArmCommand>(message); var meter = new EnergyMeter(command.Meter.serialId, userId, TypeOfEnergyMeter.House, null, command.Meter.count, command.Meter.Switch); await repository.Update(meter); } // await Clients.Group(userId).SendAsync("ReceiveMessage", message); }
public async Task ErrorMessage(string message) { var userId = NameUserIdProvider.GetUserId(Context); await Clients.Group(userId).SendAsync("ErrorMessages", message); }
public async Task JoinGroup() { //Get userId var userId = NameUserIdProvider.GetUserId(Context); await Groups.AddToGroupAsync(Context.ConnectionId, userId); }