Esempio n. 1
0
        public void Send(string actorType, byte[] data, int offset, int count)
        {
            var actor = _remoteActors.Values.Where(a => a.Type == actorType).OrderBy(t => Guid.NewGuid()).FirstOrDefault();

            if (actor != null)
            {
                var sessionKey = _actorKeys.Get(actor.GetKey());
                ActorChannelSession session = null;
                if (_sessions.TryGetValue(sessionKey, out session))
                {
                    session.Send(actorType, data, offset, count);
                }
            }
        }
Esempio n. 2
0
        public void Send(string actorType, string actorName, byte[] data, int offset, int count)
        {
            var actorKey   = ActorIdentity.GetKey(actorType, actorName);
            var sessionKey = _actorKeys.Get(actorKey);

            if (!string.IsNullOrEmpty(sessionKey))
            {
                ActorChannelSession session = null;
                if (_sessions.TryGetValue(sessionKey, out session))
                {
                    session.Send(actorType, actorName, data, offset, count);
                }
            }
        }