Saturday, 08 April 2023
  6 Replies
  1.2K Visits
  Subscribe
Hi there,

I need help.
sgcWebSocketServer
when server shutdown accidently
i try reconnect unable to continue previous rpc call
what the problem?
i have few transaction to save
line 1,2,3 was saved but when line 4 the server shutdown accidently
and after this i unable to continue next action.
here is function call ,please help

if DM.wsClient.Active = false then
begin
DM.wsClient.Host := '192.168.1.123';
DM.wsClient.Port := 8181;
try
DM.wsClient.Active := True;
if not DM.wsClient.Active then
fnShowMessage('Server not respond!', C_ERROR);
finally
end;
end;

if strJSON <> '' then begin
DM.wspProtocol.RPC(FUUID, 'save', strJSON);

thanks
1 year ago
·
#1519
Hello,

I am sorry, but I don't understand the question, what do you mean by save line 1,2,3...?

Kind Regards,
Sergio
1 year ago
·
#1520
Hi,

I am sorry but when a client disconnects (or server closes), the session is deleted, so there is no built-in mechanism to continue the session when it was closed. Although you can implement your own methods to store "sessions", this will require to use for example a database where a session id is stored and when the client reconnects, it passes this session id and the server restore the "session", so it can continue the process.

Kind Regards,
Sergio
Sorry may bad english,
mean example i have 5 item sales in 1 invoice
i entry item 1,2,3 but during item 4 entry server shut down accidently and client need reconnect to server
after reconnect should be able continue item 4,item 5 to that invoice from client.
but fail to entry item 4,5 , i have to close and reopen again only able continue.
thanks
1 year ago
·
#1521
Thanks your replied,
Can I give me a sample in Delphi fmx
Thanks
1 year ago
·
#1524
Hello,

You just need to configure your client to pass some type of identification, so the server when this client connects, stores the required data in a database. Every time the client interactuates with the server, store the data/state in the database, so if there is any disconnection, the client re-connects passing the same identification and the server can continue the process.

Kind Regards,
Sergio
1 year ago
·
#1526
Thanks your replied,
I have no idea how to code , can you please give me some example reference ?

thanks
1 year ago
·
#1529
Hello,

Yes, no problem, I'll let you know when it's ready.

Kind Regards,
Sergio
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf
· Insert · Remove
  Upload Files (Maximum 10MB)