コード例 #1
0
 public bool Handle(AddUserConnection command)
 {
     if (UserConnections.ContainsKey(command.UserConnection.ConnectionId))
     {
         UserConnections[command.UserConnection.ConnectionId] = command.UserConnection;
     }
     else
     {
         UserConnections.Add(command.UserConnection.ConnectionId, command.UserConnection);
     }
     return(true);
 }
コード例 #2
0
        public LiveWebsocketActor(
            Guid connectionId,
            Guid userId,
            WebSocket connection,
            IActorRef connectionAggregate)
        {
            _connectionId        = connectionId;
            _userId              = userId;
            _connection          = connection;
            _connectionAggregate = connectionAggregate;

            var command = new AddUserConnection(
                new UserConnection(connectionId, userId, Self));

            _connectionAggregate.Tell(command);
            Receive <SendWebsocketMessage>(Handle);
        }