Ejemplo n.º 1
0
        public async Task SubscribeTrades()
        {
            _contextHolder.BlotterHubClients = Clients;

            var user = ContextUtil.GetUserName(Context);

            Log.InfoFormat("Received trade subscription from user {0}", user);

            // add client to the trade notification group
            await Groups.Add(Context.ConnectionId, BlotterGroupName);

            Log.InfoFormat("Connection {0} of user {1} added to group '{2}'", Context.ConnectionId, user, BlotterGroupName);

            var trades = _tradeRepository.GetAllTrades();
            await Clients.Caller.OnNewTrade(trades);

            Log.InfoFormat("Snapshot published to {0}", Context.ConnectionId);
        }
Ejemplo n.º 2
0
 public IEnumerable <Trade> GetAll()
 {
     return(_repo.GetAllTrades());
 }