public void OnDisconnect(string name, string connectionId)
        {
            if (Connections.Remove(name, connectionId))
            {
                lock (Endpoints)
                {
                    Endpoints.Remove(name);
                }

                EndpointRemoved?.Invoke(name);
            }
        }
Exemplo n.º 2
0
        protected override void CreateProxy()
        {
            base.CreateProxy();

            proxy.On <EndpointConnectionInfo>("EndpointAdded", info =>
            {
                Console.WriteLine($"Endpoint added: {info}");
                EndpointAdded?.Invoke(info);
            });

            proxy.On <string>("EndpointRemoved", name =>
            {
                Console.WriteLine($"Endpoint removed: {name}");
                EndpointRemoved?.Invoke(name);
            });

            proxy.On <IEnumerable <EndpointConnectionInfo> >("EndpointListUpdated", infos =>
            {
                Console.WriteLine($"Endpoint list updated: {string.Join(", ", infos)}");
                EndpointListUpdated?.Invoke(infos);
            });

            base.CreateProxy();
        }