#1 2013-06-17 18:11:41

HK
Member
Registered: 2013-05-09
Posts: 3

Implementing Callbacks

Dear ab,
We are seriously considering to use your framework to implement a 3 tier architecture mobile POS solution. We are planning to use interface based services like the sample calculator application in directory no 14. I have the following question:
While processing a request initiated by a client the server might need more information from the client. What is the best way of implementing this? For example the client might request the server to insert an item into the customer order. While processing this request the server might realize that it needs more information about the item like for example the serial number of the item. I need a mechanism to have the server callback the client or inform the client that the serial number of the item is required. The client will then open a form to allow the user to enter the serial number and will send the serial number back to the server. The server will then complete the processing of the original request and will send the response back to the client. What is the best way of implementing this requirement?

Offline

#2 2013-06-17 18:35:59

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Implementing Callbacks

I've answered to this question in your previous post - see http://synopse.info/forum/viewtopic.php?pid=7914#p7914

smile

We may in fact continue discussion here.

Offline

#3 2013-06-26 11:29:59

HK
Member
Registered: 2013-05-09
Posts: 3

Re: Implementing Callbacks

Dear ab,

We are progressing well with the POC (proof of concept demo) of the Mobile POS application using your framework. I have another question for you:
Let us assume that the client sends a request to the server. While processing the request the server might need to send some progress information to the client. For example the client might send a request for the server to process a credit card payment. While processing the request the server will need to inform the client about the progress of processing the request. Example: Connection to the bank established, sent request, received response, etc... With Delphi components we could do that using events. Is there a way to do that using the mORMot framework? We will have 2 types of events: 1 type is while processing a request initiated by the client and another type is when the server needs to inform the clients about something outside of a request. For example the server might need to inform all the clients to logoff as the system will be under maintenance shortly. My understanding is that using your framework the client sends a request and the server processes that request and sends a response. Can we have more dialog between the client and the server while progressing a request? The messages are exchanged using http over TCP/IP. Can we use the underlying TCP session to have a more detailed dialogue between the client and server while processing the request?
It will be great if this could be done.

Regards
HK

Offline

#4 2013-06-26 11:48:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Implementing Callbacks

HTTP is by definition stateless and one-way, and follows the "request/reply" pattern.
You can not have directly callback events on HTTP (unless you switch to websockets, but it is not always welcome over the Internet).

Our framework follows by default this RESTful stateless approach.

The "events" callbacks are on the official project roadmap.
See http://blog.synopse.info/post/2012/09/0 … laboration
But it is not available yet.
Using raw TCP/IP is perhaps not an option (not rootable). See the article for implementation schemes.

For your purpose, my proposal was to use a client-driven interface based service, which will allow to have an explicit context within the implementation class on the server.
You will have to use several calls to each step. You can call the same method several times, which will return a status message or an input query request (e.g. card number), on need.
It will be transparent for the client. And will let the server be less solicited than an "events" callback mechanism - so you will be able to serve more clients at once.

Offline

Board footer

Powered by FluxBB