diff options
author | Dennis Kobert <d-kobert@web.de> | 2019-05-19 17:00:02 +0200 |
---|---|---|
committer | Dennis Kobert <d-kobert@web.de> | 2019-05-19 17:00:02 +0200 |
commit | c4d046858e0822b7c2c540ac2368b2c0e88e7a26 (patch) | |
tree | 8ff5cfd8646908784a45762a6148ebc150810160 /FireBase/Streaming/FirebaseSubscription.cs | |
parent | f89f308c525e9deebc6d2cf6416e27dfe1a299dc (diff) |
general refectoring
added 42 as dummy Token
Diffstat (limited to 'FireBase/Streaming/FirebaseSubscription.cs')
-rw-r--r-- | FireBase/Streaming/FirebaseSubscription.cs | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/FireBase/Streaming/FirebaseSubscription.cs b/FireBase/Streaming/FirebaseSubscription.cs index acdc76c..fb0f403 100644 --- a/FireBase/Streaming/FirebaseSubscription.cs +++ b/FireBase/Streaming/FirebaseSubscription.cs @@ -1,30 +1,28 @@ +using System; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading; +using System.Threading.Tasks; +using Firebase.Database.Query; +using Newtonsoft.Json.Linq; + namespace Firebase.Database.Streaming { - using System; - using System.Diagnostics; - using System.Linq; - using System.Net.Http; - using System.Net.Http.Headers; - using System.Threading; - using System.Threading.Tasks; - using Query; - using Newtonsoft.Json.Linq; - using System.Net; - /// <summary> - /// The firebase subscription. + /// The firebase subscription. /// </summary> /// <typeparam name="T"> Type of object to be streaming back to the called. </typeparam> internal class FirebaseSubscription<T> : IDisposable { + private static readonly HttpClient http; + private readonly FirebaseCache<T> cache; private readonly CancellationTokenSource cancel; + private readonly FirebaseClient client; + private readonly string elementRoot; private readonly IObserver<FirebaseEvent<T>> observer; private readonly IFirebaseQuery query; - private readonly FirebaseCache<T> cache; - private readonly string elementRoot; - private readonly FirebaseClient client; - - private static HttpClient http; static FirebaseSubscription() { @@ -43,7 +41,7 @@ namespace Firebase.Database.Streaming } /// <summary> - /// Initializes a new instance of the <see cref="FirebaseSubscription{T}"/> class. + /// Initializes a new instance of the <see cref="FirebaseSubscription{T}" /> class. /// </summary> /// <param name="observer"> The observer. </param> /// <param name="query"> The query. </param> @@ -59,13 +57,13 @@ namespace Firebase.Database.Streaming client = query.Client; } - public event EventHandler<ExceptionEventArgs<FirebaseException>> ExceptionThrown; - public void Dispose() { cancel.Cancel(); } + public event EventHandler<ExceptionEventArgs<FirebaseException>> ExceptionThrown; + public IDisposable Run() { Task.Run(() => ReceiveThread()); |