Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetStreaming is not functioning #4

Closed
hasibul2363 opened this issue Mar 8, 2015 · 5 comments
Closed

GetStreaming is not functioning #4

hasibul2363 opened this issue Mar 8, 2015 · 5 comments

Comments

@hasibul2363
Copy link

Hi I have used following code to get the streaming data but after executing
fb.GetStreaming it goes freeze. No event is firing. Need you help

string rootUri = "https://chat-todoapp.firebaseio.com/";
string authToken = "MY KEY";
Firebase fb = new Firebase(rootUri, authToken);
fb.GetStreaming("UserMessagesV1/hasibul2363@gmailcom/sopnomoijarna@gmailcom",
added: (s, args) => AddedItem(args), changed: (s, args) => UpdatedItem(args), removed: (s, args) => RemovedItem(args));

@owen2
Copy link

owen2 commented Apr 18, 2015

I'm having the same issue with FirebaseSharpPortable. My callbacks never run.

@bubbafat
Copy link
Owner

I suspect this has something to do with auth tokens. I'm starting to look into it this weekend but I'm pretty busy at the moment. If you run without an auth token (in your Firebase ctor) does it function?

@bubbafat
Copy link
Owner

hasibul2363 - when you say "MY KEY" ... are you providing your secret or some other auth key? If it is something else ... what is it?

owen2 - same question. Are you using authentication?

@owen2
Copy link

owen2 commented Apr 21, 2015

Yes, I'm using an auth key. I'm using this library to hit the nest api, which requires it. I tried to connect without an auth key, but nest doesn't allow it.

Thanks for looking into this.

@bubbafat
Copy link
Owner

Try the latest source or nuget package 1.0.0.4 (just uploaded to nuget) - let me know if this does not resolve the issue.

I created a demo app specifically for connecting to Nest - it is setup for PIN based auth. You provide your client ID and secret, then click the "Get PIN" button - this opens a browser where you authenticate with the app and get your PIN. Type your PIN into the PIN text box. Then click "Get Token" - this uses the PIN data to get the auth token (filled into the token text field) - then you click "Make Call" which does an authenticated streaming get from the root - it should put some details into the big text box on the bottom of the app.

After my latest changes I was able to stream data from Nest. Though I don't have a Nest device so I'm only able to get the first set of streaming results and heartbeats.

Basically the problem was that await-able calls were trying to run on the UI or web sync context which causes HttpClient.GetAsync to block (among other things) ... using a ConfigureAwait(false) avoids the problem.

I'll be re-thinking some of the this when I have more time but it does seem to address the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants