Created
March 25, 2014 16:29
-
-
Save bubbafat/9765654 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static async Task Listen(string url) | |
{ | |
HttpClient client = new HttpClient(); | |
client.Timeout = TimeSpan.FromHours(1); | |
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/event-stream")); | |
var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead); | |
using(var content = await response.Content.ReadAsStreamAsync()) | |
using (StreamReader sr = new StreamReader(content)) | |
{ | |
while (true) | |
{ | |
Console.WriteLine(await sr.ReadLineAsync()); | |
} | |
} | |
} | |
/* | |
Listen("https://[YOUR HOST].firebaseio.com/test.json").Wait(); | |
curl -X POST -d "{\"user\": \"me\", \"body\": \"Yey!\"}" https://[YOUR HOST].firebaseio.com/test.json | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment