示例#1
0
        /// <summary>
        /// Enables presence for the specified channel with first 100 unique metadata if metadata is set to true.
        /// </summary>
        /// <param name="privateKey">The private key provided when the ORTC service is purchased.</param>
        /// <param name="channel">Channel to activate presence.</param>
        /// <param name="metadata">Defines if to collect first 100 unique metadata.</param>
        /// <param name="callback">Callback with error <see cref="OrtcPresenceException"/> and result.</param>
        /// /// <example>
        /// <code>
        /// client.EnablePresence("myPrivateKey", "presence-channel", false, (error, result) =>
        /// {
        ///     if (error != null)
        ///     {
        ///         System.Diagnostics.Debug.Writeline(error.Message);
        ///     }
        ///     else
        ///     {
        ///         System.Diagnostics.Debug.Writeline(result);
        ///     }
        /// });
        /// </code>
        /// </example>
        public void EnablePresence(String privateKey, String channel, bool metadata, OnEnablePresenceDelegate callback)
        {
            var isCluster = !String.IsNullOrEmpty(this.ClusterUrl);
            var url       = String.IsNullOrEmpty(this.ClusterUrl) ? this.Url : this.ClusterUrl;

            Ext.Presence.EnablePresence(url, isCluster, this._applicationKey, privateKey, channel, metadata, callback);
        }
示例#2
0
 /// <summary>
 /// Enables presence for the specified channel with first 100 unique metadata if metadata is set to true.
 /// </summary>
 /// <param name="url">Server containing the presence service.</param>
 /// <param name="isCluster">Specifies if url is cluster</param>
 /// <param name="applicationKey">Application key with access to presence service.</param>
 /// <param name="privateKey">The private key provided when the ORTC service is purchased.</param>
 /// <param name="channel">Channel to activate presence.</param>
 /// <param name="metadata">Defines if to collect first 100 unique metadata.</param>
 /// <param name="callback">Callback with error <see cref="OrtcPresenceException"/> and result.</param>
 /// /// <example>
 /// <code>
 /// client.EnablePresence("myPrivateKey", "presence-channel", false, (error, result) =>
 /// {
 ///     if (error != null)
 ///     {
 ///         System.Diagnostics.Debug.Writeline(error.Message);
 ///     }
 ///     else
 ///     {
 ///         System.Diagnostics.Debug.Writeline(result);
 ///     }
 /// });
 /// </code>
 /// </example>
 public static void EnablePresence(String url, Boolean isCluster, String applicationKey, String privateKey, String channel, bool metadata, OnEnablePresenceDelegate callback)
 {
     Ext.Presence.EnablePresence(url, isCluster, applicationKey, privateKey, channel, metadata, callback);
 }
示例#3
0
 /// <summary>
 /// Enables presence for the specified channel with first 100 unique metadata if metadata is set to true.
 /// </summary>
 /// <param name="url">Server containing the presence service.</param>
 /// <param name="isCluster">Specifies if url is cluster.</param>
 /// <param name="applicationKey">Application key with access to presence service.</param>
 /// <param name="privateKey">The private key provided when the ORTC service is purchased.</param>
 /// <param name="channel">Channel to activate presence.</param>
 /// <param name="metadata">Defines if to collect first 100 unique metadata.</param>
 /// <param name="callback">Callback with error <see cref="OrtcPresenceException"/> and result.</param>
 /// <example>
 /// <code>
 /// Ibt.Ortc.Api.Ortc.EnablePresence("http://ortc-developers.realtime.co/server/2.1", true, "myApplicationKey", "myPrivateKey", "presence-channel", false, (error, result) =>
 /// {
 ///     if (error != null)
 ///     {
 ///         Console.WriteLine(error.Message);
 ///     }
 ///     else
 ///     {
 ///         Console.WriteLine(result);
 ///     }
 /// });
 /// </code>
 /// </example>
 public static void EnablePresence(String url, bool isCluster, String applicationKey, String privateKey, String channel, bool metadata, OnEnablePresenceDelegate callback)
 {
     Ibt.Ortc.Api.Extensibility.Presence.EnablePresence(url, isCluster, applicationKey, privateKey, channel, metadata, callback);
 }
示例#4
0
        /// <summary>
        /// Enables presence for the specified channel with first 100 unique metadata if metadata is set to true.
        /// </summary>
        /// <param name="url">Server containing the presence service.</param>
        /// <param name="isCluster">Specifies if url is cluster.</param>
        /// <param name="applicationKey">Application key with access to presence service.</param>
        /// <param name="privateKey">The private key provided when the ORTC service is purchased.</param>
        /// <param name="channel">Channel to activate presence.</param>
        /// <param name="metadata">Defines if to collect first 100 unique metadata.</param>
        /// <param name="callback">Callback with error <see cref="OrtcPresenceException"/> and result.</param>
        /// <example>
        /// <code>
        /// client.EnablePresence("http://ortc-developers.realtime.co/server/2.1", true, "myApplicationKey", "myPrivateKey", "presence-channel", false, (error, result) =>
        /// {
        ///     if (error != null)
        ///     {
        ///         Console.WriteLine(error.Message);
        ///     }
        ///     else
        ///     {
        ///         Console.WriteLine(result);
        ///     }
        /// });
        /// </code>
        /// </example>
        public static void EnablePresence(String url, bool isCluster, String applicationKey, String privateKey, String channel, bool metadata, OnEnablePresenceDelegate callback)
        {
            Balancer.GetServerUrl(url, isCluster, applicationKey, (error, server) =>
            {
                var presenceUrl = String.IsNullOrEmpty(server) ? server : server[server.Length - 1] == '/' ? server : server + "/";
                presenceUrl = String.Format("{0}presence/enable/{1}/{2}", presenceUrl, applicationKey, channel);

                var content = String.Format("privatekey={0}", privateKey);

                if (metadata)
                {
                    content = String.Format("{0}&metadata=1", content);
                }

                RestWebservice.PostAsync(presenceUrl, content, (responseError, result) =>
                {
                    if (responseError != null)
                    {
                        callback(responseError, null);
                    }
                    else
                    {
                        callback(null, result);
                    }
                });
            });
        }
 /// <summary>
 /// Enables presence for the specified channel with first 100 unique metadata if metadata is set to true.
 /// </summary>
 /// <param name="privateKey">The private key provided when the ORTC service is purchased.</param>
 /// <param name="channel">Channel to activate presence.</param>
 /// <param name="metadata">Defines if to collect first 100 unique metadata.</param>
 /// <param name="callback">Callback with error <see cref="OrtcPresenceException"/> and result.</param>
 /// /// <example>
 /// <code>
 /// client.EnablePresence("myPrivateKey", "presence-channel", false, (error, result) =>
 /// {
 ///     if (error != null)
 ///     {
 ///         Console.WriteLine(error.Message);
 ///     }
 ///     else
 ///     {
 ///         Console.WriteLine(result);
 ///     }
 /// });
 /// </code>
 /// </example>
 public abstract void EnablePresence(String privateKey, String channel, bool metadata, OnEnablePresenceDelegate callback);
 /// <summary>
 /// Enables presence for the specified channel with first 100 unique metadata if metadata is set to true.
 /// </summary>
 /// <param name="privateKey">The private key provided when the ORTC service is purchased.</param>
 /// <param name="channel">Channel to activate presence.</param>
 /// <param name="metadata">Defines if to collect first 100 unique metadata.</param>
 /// <param name="callback">Callback with error <see cref="OrtcPresenceException"/> and result.</param>
 /// /// <example>
 /// <code>
 /// client.EnablePresence("myPrivateKey", "presence-channel", false, (error, result) =>
 /// {
 ///     if (error != null)
 ///     {
 ///         Console.WriteLine(error.Message);
 ///     }
 ///     else
 ///     {
 ///         Console.WriteLine(result);
 ///     }
 /// });
 /// </code>
 /// </example>
 public abstract void EnablePresence(String privateKey, String channel, bool metadata, OnEnablePresenceDelegate callback);
示例#7
0
 /// <summary>
 /// Enables presence for the specified channel with first 100 unique metadata if metadata is set to true.
 /// </summary>
 /// <param name="url">Server containing the presence service.</param>
 /// <param name="isCluster">Specifies if url is cluster.</param>
 /// <param name="applicationKey">Application key with access to presence service.</param>
 /// <param name="privateKey">The private key provided when the ORTC service is purchased.</param>
 /// <param name="channel">Channel to activate presence.</param>
 /// <param name="metadata">Defines if to collect first 100 unique metadata.</param>
 /// <param name="callback">Callback with error <see cref="OrtcPresenceException"/> and result.</param>
 /// <example>
 /// <code>
 /// Ibt.Ortc.Api.Ortc.EnablePresence("http://ortc-developers.realtime.co/server/2.1", true, "myApplicationKey", "myPrivateKey", "presence-channel", false, (error, result) =>
 /// {
 ///     if (error != null)
 ///     {
 ///         Console.WriteLine(error.Message);
 ///     }
 ///     else
 ///     {
 ///         Console.WriteLine(result);
 ///     }
 /// });
 /// </code>
 /// </example>
 public static void EnablePresence(String url, bool isCluster, String applicationKey, String privateKey, String channel, bool metadata, OnEnablePresenceDelegate callback)
 {
     Ibt.Ortc.Api.Extensibility.Presence.EnablePresence(url, isCluster, applicationKey, privateKey, channel, metadata, callback);
 }
        public override void EnablePresence(String privateKey, String channel, bool metadata, OnEnablePresenceDelegate callback)
        {
            var isCluster = !String.IsNullOrEmpty(this.ClusterUrl);
            var url = String.IsNullOrEmpty(this.ClusterUrl) ? this.Url : this.ClusterUrl;

            Ibt.Ortc.Api.Extensibility.Presence.EnablePresence(url, isCluster, this._applicationKey, privateKey, channel, metadata, callback);
        }