コード例 #1
0
ファイル: OrtcClient.cs プロジェクト: gbanfill/geogames
        /// <summary>
        /// Gets the subscriptions in the specified channel and if active the first 100 unique metadata.
        /// </summary>
        /// <param name="channel">Channel with presence data active.</param>
        /// <param name="callback"><see cref="OnPresenceDelegate"/>Callback with error <see cref="OrtcPresenceException"/> and result <see cref="Presence"/>.</param>
        /// <example>
        /// <code>
        /// client.Presence("presence-channel", (error, result) =>
        /// {
        ///     if (error != null)
        ///     {
        ///         System.Diagnostics.Debug.Writeline(error.Message);
        ///     }
        ///     else
        ///     {
        ///         if (result != null)
        ///         {
        ///             System.Diagnostics.Debug.Writeline(result.Subscriptions);
        ///
        ///             if (result.Metadata != null)
        ///             {
        ///                 foreach (var metadata in result.Metadata)
        ///                 {
        ///                     System.Diagnostics.Debug.Writeline(metadata.Key + " - " + metadata.Value);
        ///                 }
        ///             }
        ///         }
        ///         else
        ///         {
        ///             System.Diagnostics.Debug.Writeline("There is no presence data");
        ///         }
        ///     }
        /// });
        /// </code>
        /// </example>
        public void Presence(String channel, OnPresenceDelegate callback)
        {
            var isCluster = !String.IsNullOrEmpty(this.ClusterUrl);
            var url       = String.IsNullOrEmpty(this.ClusterUrl) ? this.Url : this.ClusterUrl;

            Ext.Presence.GetPresence(url, isCluster, this._applicationKey, this._authenticationToken, channel, callback);
        }
コード例 #2
0
        /// <summary>
        /// Gets the subscriptions in the specified channel and if active the first 100 unique metadata.
        /// </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="authenticationToken">Authentication token with access to presence service.</param>
        /// <param name="channel">Channel with presence data active.</param>
        /// <param name="callback"><see cref="OnPresenceDelegate"/>Callback with error <see cref="OrtcPresenceException"/> and result <see cref="Presence"/>.</param>
        /// <example>
        /// <code>
        /// client.Presence("http://ortc-developers.realtime.co/server/2.1", true, "myApplicationKey", "myAuthenticationToken", "presence-channel", (error, result) =>
        /// {
        ///     if (error != null)
        ///     {
        ///         Console.WriteLine(error.Message);
        ///     }
        ///     else
        ///     {
        ///         if (result != null)
        ///         {
        ///             Console.WriteLine(result.Subscriptions);
        ///
        ///             if (result.Metadata != null)
        ///             {
        ///                 foreach (var metadata in result.Metadata)
        ///                 {
        ///                     Console.WriteLine(metadata.Key + " - " + metadata.Value);
        ///                 }
        ///             }
        ///         }
        ///         else
        ///         {
        ///             Console.WriteLine("There is no presence data");
        ///         }
        ///     }
        /// });
        /// </code>
        /// </example>
        public static void GetPresence(String url, bool isCluster, String applicationKey, String authenticationToken, String channel, OnPresenceDelegate callback)
        {
            Balancer.GetServerUrl(url, isCluster, applicationKey, (error, server) =>
            {
                if (error == null)
                {
                    var presenceUrl = String.IsNullOrEmpty(server) ? server : server[server.Length - 1] == '/' ? server : server + "/";
                    presenceUrl     = String.Format("{0}presence/{1}/{2}/{3}", presenceUrl, applicationKey, authenticationToken, channel);

                    RestWebservice.GetAsync(presenceUrl, (responseError, result) =>
                    {
                        if (responseError != null)
                        {
                            callback(responseError, null);
                        }
                        else
                        {
                            Presence presenceData = new Presence();
                            if (!String.IsNullOrEmpty(result))
                            {
                                presenceData = Extensibility.Presence.Deserialize(result);
                            }
                            callback(null, presenceData);
                        }
                    });
                }
                else
                {
                    callback(new OrtcPresenceException(error.Message), null);
                }
            });
        }
コード例 #3
0
 /// <summary>
 /// Gets the subscriptions in the specified channel and if active the first 100 unique metadata.
 /// </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="authenticationToken">Authentication token with access to presence service.</param>
 /// <param name="channel">Channel with presence data active.</param>
 /// <param name="callback"><see cref="OnPresenceDelegate"/>Callback with error <see cref="OrtcPresenceException"/> and result <see cref="Presence"/>.</param>
 /// <example>
 /// <code>
 /// client.Presence("presence-channel", (error, result) =>
 /// {
 ///     if (error != null)
 ///     {
 ///         System.Diagnostics.Debug.Writeline(error.Message);
 ///     }
 ///     else
 ///     {
 ///         if (result != null)
 ///         {
 ///             System.Diagnostics.Debug.Writeline(result.Subscriptions);
 ///
 ///             if (result.Metadata != null)
 ///             {
 ///                 foreach (var metadata in result.Metadata)
 ///                 {
 ///                     System.Diagnostics.Debug.Writeline(metadata.Key + " - " + metadata.Value);
 ///                 }
 ///             }
 ///         }
 ///         else
 ///         {
 ///             System.Diagnostics.Debug.Writeline("There is no presence data");
 ///         }
 ///     }
 /// });
 /// </code>
 /// </example>
 public static void Presence(String url, Boolean isCluster, String applicationKey, String authenticationToken, String channel, OnPresenceDelegate callback)
 {
     Ext.Presence.GetPresence(url, isCluster, applicationKey, authenticationToken, channel, callback);
 }
コード例 #4
0
ファイル: Ortc.cs プロジェクト: GP89/RealtimeMessaging-dotnet
 /// <summary>
 /// Gets the subscriptions in the specified channel and if active the first 100 unique metadata.
 /// </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="authenticationToken">Authentication token with access to presence service.</param>
 /// <param name="channel">Channel with presence data active.</param>
 /// <param name="callback"><see cref="OnPresenceDelegate"/>Callback with error <see cref="OrtcPresenceException"/> and result <see cref="Presence"/>.</param>
 /// <example>
 /// <code>
 /// Ibt.Ortc.Api.Ortc.Presence("http://ortc-developers.realtime.co/server/2.1", true, "myApplicationKey", "myAuthenticationToken", "presence-channel", (error, result) =>
 /// {
 ///     if (error != null)
 ///     {
 ///         Console.WriteLine(error.Message);
 ///     }
 ///     else
 ///     {
 ///         if (result != null)
 ///         {
 ///             Console.WriteLine(result.Subscriptions);
 ///
 ///             if (result.Metadata != null)
 ///             {
 ///                 foreach (var metadata in result.Metadata)
 ///                 {
 ///                     Console.WriteLine(metadata.Key + " - " + metadata.Value);
 ///                 }
 ///             }
 ///         }
 ///         else
 ///         {
 ///             Console.WriteLine("There is no presence data");
 ///         }
 ///     }
 /// });
 /// </code>
 /// </example>
 public static void Presence(String url, bool isCluster, String applicationKey, String authenticationToken, String channel, OnPresenceDelegate callback)
 {
     Ibt.Ortc.Api.Extensibility.Presence.GetPresence(url, isCluster, applicationKey, authenticationToken, channel, callback);
 }
コード例 #5
0
        /// <summary>
        /// Gets the subscriptions in the specified channel and if active the first 100 unique metadata.
        /// </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="authenticationToken">Authentication token with access to presence service.</param>
        /// <param name="channel">Channel with presence data active.</param>
        /// <param name="callback"><see cref="OnPresenceDelegate"/>Callback with error <see cref="OrtcPresenceException"/> and result <see cref="Presence"/>.</param>
        /// <example>
        /// <code>
        /// client.Presence("http://ortc-developers.realtime.co/server/2.1", true, "myApplicationKey", "myAuthenticationToken", "presence-channel", (error, result) =>
        /// {
        ///     if (error != null)
        ///     {
        ///         Console.WriteLine(error.Message);
        ///     }
        ///     else
        ///     {
        ///         if (result != null)
        ///         {
        ///             Console.WriteLine(result.Subscriptions);
        /// 
        ///             if (result.Metadata != null)
        ///             {
        ///                 foreach (var metadata in result.Metadata)
        ///                 {
        ///                     Console.WriteLine(metadata.Key + " - " + metadata.Value);
        ///                 }
        ///             }
        ///         }
        ///         else
        ///         {
        ///             Console.WriteLine("There is no presence data");
        ///         }
        ///     }
        /// });
        /// </code>
        /// </example>
        public static void GetPresence(String url, bool isCluster, String applicationKey, String authenticationToken, String channel, OnPresenceDelegate 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/{1}/{2}/{3}", presenceUrl, applicationKey, authenticationToken, channel);

                RestWebservice.GetAsync(presenceUrl, (responseError, result) =>
                {
                    if (responseError != null)
                    {
                        callback(responseError, null);
                    }
                    else
                    {
                        Presence presenceData = new Presence();
                        if (!String.IsNullOrEmpty(result))
                        {
                            presenceData = Extensibility.Presence.Deserialize(result);
                        }
                        callback(null, presenceData);
                    }
                });
            });
        }
コード例 #6
0
 /// <summary>
 /// Gets the subscriptions in the specified channel and if active the first 100 unique metadata.
 /// </summary>
 /// <param name="channel">Channel with presence data active.</param>
 /// <param name="callback"><see cref="OnPresenceDelegate"/>Callback with error <see cref="OrtcPresenceException"/> and result <see cref="Presence"/>.</param>
 /// <example>
 /// <code>
 /// client.Presence("presence-channel", (error, result) =>
 /// {
 ///     if (error != null)
 ///     {
 ///         Console.WriteLine(error.Message);
 ///     }
 ///     else
 ///     {
 ///         if (result != null)
 ///         {
 ///             Console.WriteLine(result.Subscriptions);
 ///
 ///             if (result.Metadata != null)
 ///             {
 ///                 foreach (var metadata in result.Metadata)
 ///                 {
 ///                     Console.WriteLine(metadata.Key + " - " + metadata.Value);
 ///                 }
 ///             }
 ///         }
 ///         else
 ///         {
 ///             Console.WriteLine("There is no presence data");
 ///         }
 ///     }
 /// });
 /// </code>
 /// </example>
 public abstract void Presence(String channel, OnPresenceDelegate callback);
コード例 #7
0
 /// <summary>
 /// Gets the subscriptions in the specified channel and if active the first 100 unique metadata.
 /// </summary>
 /// <param name="channel">Channel with presence data active.</param>
 /// <param name="callback"><see cref="OnPresenceDelegate"/>Callback with error <see cref="OrtcPresenceException"/> and result <see cref="Presence"/>.</param>
 /// <example>
 /// <code>
 /// client.Presence("presence-channel", (error, result) =>
 /// {
 ///     if (error != null)
 ///     {
 ///         Console.WriteLine(error.Message);
 ///     }
 ///     else
 ///     {
 ///         if (result != null)
 ///         {
 ///             Console.WriteLine(result.Subscriptions);
 /// 
 ///             if (result.Metadata != null)
 ///             {
 ///                 foreach (var metadata in result.Metadata)
 ///                 {
 ///                     Console.WriteLine(metadata.Key + " - " + metadata.Value);
 ///                 }
 ///             }
 ///         }
 ///         else
 ///         {
 ///             Console.WriteLine("There is no presence data");
 ///         }
 ///     }
 /// });
 /// </code>
 /// </example>
 public abstract void Presence(String channel, OnPresenceDelegate callback);
コード例 #8
0
ファイル: Ortc.cs プロジェクト: l0hn/RealtimeMessaging-dotnet
 /// <summary>
 /// Gets the subscriptions in the specified channel and if active the first 100 unique metadata.
 /// </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="authenticationToken">Authentication token with access to presence service.</param>
 /// <param name="channel">Channel with presence data active.</param>
 /// <param name="callback"><see cref="OnPresenceDelegate"/>Callback with error <see cref="OrtcPresenceException"/> and result <see cref="Presence"/>.</param>
 /// <example>
 /// <code>
 /// Ibt.Ortc.Api.Ortc.Presence("http://ortc-developers.realtime.co/server/2.1", true, "myApplicationKey", "myAuthenticationToken", "presence-channel", (error, result) =>
 /// {
 ///     if (error != null)
 ///     {
 ///         Console.WriteLine(error.Message);
 ///     }
 ///     else
 ///     {
 ///         if (result != null)
 ///         {
 ///             Console.WriteLine(result.Subscriptions);
 /// 
 ///             if (result.Metadata != null)
 ///             {
 ///                 foreach (var metadata in result.Metadata)
 ///                 {
 ///                     Console.WriteLine(metadata.Key + " - " + metadata.Value);
 ///                 }
 ///             }
 ///         }
 ///         else
 ///         {
 ///             Console.WriteLine("There is no presence data");
 ///         }
 ///     }
 /// });
 /// </code>
 /// </example>
 public static void Presence(String url, bool isCluster, String applicationKey, String authenticationToken, String channel, OnPresenceDelegate callback)
 {
     Ibt.Ortc.Api.Extensibility.Presence.GetPresence(url, isCluster, applicationKey, authenticationToken, channel, callback);
 }
コード例 #9
0
        public override void Presence(String channel, OnPresenceDelegate callback)
        {
            var isCluster = !String.IsNullOrEmpty(this.ClusterUrl);
            var url = String.IsNullOrEmpty(this.ClusterUrl) ? this.Url : this.ClusterUrl;

            Ibt.Ortc.Api.Extensibility.Presence.GetPresence(url, isCluster, this._applicationKey, this._authenticationToken, channel, callback);
        }