-
Notifications
You must be signed in to change notification settings - Fork 3
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
long polling - how it works? #2
Comments
Hi Andy,
for more information: https://javascript.info/long-polling |
Hi Rob,
Thank you for your quick response. I think your answer and the given link
for a simple service is very helpful.
Thank you very much !
- Andy -
Am Di., 28. Dez. 2021 um 11:47 Uhr schrieb Rob Lans <
***@***.***>:
… Hi Andy,
1. A request is sent to the server.
2. The server doesn’t close the connection until it has a message to
send.
3. When a message appears – the server responds to the request with it.
4. The client makes a new request immediately.
for more information: https://javascript.info/long-polling
—
Reply to this email directly, view it on GitHub
<#2 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFTGLQWKIQG3R65D2QW4YA3UTGIVVANCNFSM5K34FFCA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@roblans Excellent library. I was trying to replicate the official player in Ionic/React to run on my Android TV. However I ran into a problem. The BluSound player doesn't like a shorter retry interval when the client polls for the status. I had it every 1 second and I started seeing connection errors. I see you have the retry at 5 seconds. Which makes me think that their API is not really useful for a real time player. |
The retry of 5 seconds is only used to restore the connection in case of an error. Real time notifications are provided by the long-polling mechanism. |
When the player is playing then the web server returns the status and closes the connection. So I have to resend the request for a new status after 1 sec, this is where the problem is. If the player is paused then the long polling connection is kept open. |
This is new to me, I'm using this library with 2 different BluOS players and have never encountered this. |
I am using React + Axios. Maybe that's the difference? I made some adjustments to prevent unnecessary rendering and now the long polling request just sits there while the player is playing. It only completes when the player pauses or changes tracks (I am using my phone to change the tracks etc.) I am passing the etag and timeout once I get it. |
Hello Rob
i would like to control my bluesound device via javascript. Can you explain to me how to implement "long polling"?
Thank You
The text was updated successfully, but these errors were encountered: