PDA

View Full Version : empty response polling provider



rblon
23 Nov 2009, 1:00 PM
I have a polling provider checking for updates. If there isn't any update, I have the server giving back an empty response. However, in FireBug I see this causes an error ("response is null") on the first request, but not on subsequent polling requests.
My questions are as follows:
1) Is there any downside to return an empty response instead of a message event?
2) If not, how can I get rid of the error? Otherwise, what is the 'proper' response?

aw1zard2
23 Nov 2009, 1:52 PM
Not that I know of but I have used just returning 0 or 1 just like true or false on a poll.

rblon
23 Nov 2009, 2:30 PM
With "I have used just returning 0", I assume you mean a JSON response like


{"type":"event","name":"message","data":"0"}
However, I would prefer a true empty response (so not just an empty data property), as that would save:
- server bandwidth (I agree not a lot, but I want the polling as efficient as possible)
- a useless event on the client side

Unless there is a reason to avoid empty responses.