You are not logged in.
Pages: 1
Hello,
I need to make the connection between client and server happens through a thread, besides the main application thread, because sometimes the connection may take longer than normal and the application freezes for a few seconds waiting for the end of the connection.
What better way to do this? Is there another way to solve this freezing?
Thanks.
Offline
The thread that I'm talking about would be on the client side, can I use a thread to connect?
Offline
OK, how can I make to force the client to create a new thread, on the client side, to connect to the server?
Last edited by Kobe (2013-07-02 11:41:30)
Offline
Would the new class should work over the TSQLHttpClient class?
Do you think a implementation like this can be good to the mORMot project, working as a option to the current implementation?
Last edited by Kobe (2013-07-02 14:19:12)
Offline
Yes
Does that make any sense for the mORMot project?
Last edited by Kobe (2013-07-02 17:34:53)
Offline
Wich is better to solve the freezing problem: the asynchronous mode or the edicated thread for background process?
How can I help you on this development? I'm not as wise as you're on Delphi development.
Offline
How would work this Asynchronous mode?
Offline
Either with an overriden TSQLRestClient.URI() which will allow calling a custom property during waiting (e.g. for Application.ProcessMessage), and use a background thread during the blocking communication.
Or with a dedicated "tasker" - new TTask class which may be also needed for implement future event-driven programming - http://blog.synopse.info/post/2012/09/0 … laboration
Offline
...and use a background thread during the blocking communication.
What would be the function of this background thread?
Offline
What would be the function of this background thread?
... doing the blocking communication itself, without blocking the main thread, so the main UI.
You have several options, e.g.
- the microsoft Task class - http://msdn.microsoft.com/en-us/library … .task.aspx
- the RemObject asynchronous call - http://wiki.remobjects.com/wiki/Asynchr … K_(Delphi)
- Or just allow to run an "idle" method e.g. to run Application.ProcessMessage, display a popup window if times is noticeable, and/or allow request cancel.
Perhaps the 3rd could be OK..
Offline
I believe the 2nd may be the better option, and can solve this feature request: http://synopse.info/fossil/info/68337ae98a
Offline
I believe the 2nd may be the better option, and can solve this feature request: http://synopse.info/fossil/info/68337ae98a
But I'm still not convinced about the "exploded" new interface in such case.
If the purpose is only to let the UI interact properly as expected, the 3rd solution is clean & enough.
This is what I will do in the short term - prepared by http://synopse.info/fossil/info/a5ae673869 latest commit, in fact.
Then event-driven publish/subscribe methods will probably a better option than this RemObjects' "exploded" interfaces.
Offline
You are totally right. I was testing and the connection got a little bit faster too, is that related to this change too?
Offline
Take a look at http://synopse.info/forum/viewtopic.php?pid=8045#p8045
Enjoy!
Offline
Pages: 1