-
Notifications
You must be signed in to change notification settings - Fork 177
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
poll timeout increase for near realtime outgoing delivery #16
Comments
My guess is that this would already work. EnvayaSMS uses a connection pool that allows two concurrent HTTP requests. You could set the EnvayaSMS poll interval to 1 minute and then configure your server to hold the request for ~55 seconds. Does that work? |
Oh, I see, that probably doesn't work now because the HTTP socket timeout is set to 10 seconds. I suppose we could just increase the timeout to 60 seconds. |
Yes, the timeout is too short at the moment. Verified. |
I can see some potential issue with such a short timeout hardcoded in EnvayaSMS, but I do understand the purpose of having such short timeout: the shortest Poll Interval is 15 seconds, so the active poll process must be ended before another kick in. The quick "fix" is to have timeout near the Poll Interval value. Say 10 or 20 seconds before the next process start. The issue here is that, once EnvayaSMS got the SMS delivered on the first query, it will still wait for next schedule poll - which can be very long from the first one if the poll timer isn't based on "time between each poll". |
Try installing EnvayaSMS-long-poll.apk on https://github.com/youngj/EnvayaSMS/downloads ... it has a socket timeout of 60 seconds, only runs one poller task at a time, and adds an option for a poll interval of 5 seconds. So just set Poll Interval to 5 seconds, and hold the server CGI for < 60 seconds... let me know if it works for you. |
Yes it works. I've set to hold the CGI for 10 seconds, poll interval of 5 seconds, the app query the server and stay on for 10 seconds till the server release, and hit back the server immediately with subsequence query. This is exactly the behavior that we were expecting. Sweet! |
Great. Released as 2.0.4. |
I would like to suggest a method that we are using at http level to achieve "near instant" of message delivery between server and client where the client can only pull the server for incoming message -- browser based chat system for example -- which is very similar to what EnvayaSMS doing now to get message from server.
When the client (the browser or EnvayaSMS) connect to the server via http, instead of giving it a short timeout of couple seconds, it should wait for a pre-defined period of time before dropping off the socket (40 seconds seems a magic number, the desktop browser would wait like forever).
The server holds the connection and continue to lookup up for new message for the client during the "hold-on" time - for a pre-defined period of time as well (again, 40 seconds is the magic number).
The server will return empty and end the http session if there isn't any new outgoing SMS (just like a usual outgoing call).
However, if these IS new outgoing SMS incur during the hold-on period, the server will immediately respond with proper XML and end the http session (again, just like a usual outgoing call).
By doing so, we believed message can be relayed more efficiently without tapping more on the service/client resources.
What EnvayaSMS needs:
I can see some troubles implement this if the "incoming" or "send_status" query are running in serial with the "outgoing" instead of independent thread.
The text was updated successfully, but these errors were encountered: