Ejemplo n.º 1
0
        public void AddUserToGroup()
        {
            var endpoint = TestEnvironment.Endpoint;
            var key      = TestEnvironment.Key;

            var client = new WebPubSubServiceClient(new Uri(endpoint), "some_hub", new AzureKeyCredential(key));

            client.AddUserToGroup("some_group", "some_user");

            // Avoid sending messages to users who do not exist.
            if (client.UserExists("some_user").Value)
            {
                client.SendToUser("some_user", "Hi, I am glad you exist!");
            }

            client.RemoveUserFromGroup("some_group", "some_user");
        }
        public void AddUserToGroup()
        {
            var connectionString = TestEnvironment.ConnectionString;
            var client           = new WebPubSubServiceClient(connectionString, "some_hub");

            #region Snippet:WebPubSubAddUserToGroup
            client.AddUserToGroup("some_group", "some_user");

            // Avoid sending messages to users who do not exist.
            if (client.UserExists("some_user").Value)
            {
                client.SendToUser("some_user", "Hi, I am glad you exist!");
            }

            client.RemoveUserFromGroup("some_group", "some_user");
            #endregion
        }