Delphi Datasnap Callback - Warn the Client about something

Asked

Viewed 962 times

0

I am now starting to implement in Datasnap. I searched a lot but I did not find solution, perhaps for my inexperience, I am missing something very simple.

I need to find a way to send a message to the client connected to the server. For example I want to warn such client that it needs to update, terminate its connection or who knows how to display a message on the user screen.

I have read several articles and downloaded several examples about Callback, but as far as I can understand, at least in the examples, is that only the client calls the Callback, it requests the server and the server responds, I need to do the reverse of this, it is possible?

Grateful

1 answer

0

This is possible yes, through callback. Whoever fires the callback is the server, and the client receives the message and processes.

Read this article, it explains right how to implement callback in both client and server: https://edn.embarcadero.com/article/41374

In short, on your client you register in a callback channel and pass a method that will be executed every time you receive a message, and on the server you trigger a broadcast on the same channel, and all registered clients will receive the message, it is possible to pass parameters in these messages.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.