You are not logged in.
Pages: 1
Hi,
I would like to ask if client/server callbacks are possible to implement with mOrmort framework which rather support stateless behavior.
Offline
By stateless behavior I mean you can not broadcast messages from server to all connected clients through a predefined channel.
Offline
You can easily make a manual broadcasting by calling a list of callback interface instances from the server side.
The benefits are that
- it will work very fast (the loop and call to all interfaces array will be non blocking)
- you can tune which clients should be broadcasted (broadcasting to all clients is not a good idea in practice)
- if the code isn't over a network (e.g. the callback has been registered on the server side), the interface call will be directly in the same process, just like a regular method call, without using any websockets
At lower level, you can use TWebSocketServer.WebSocketBroadcast() to broadcast to all connected clients.
Offline
Hi,
@ab Thanks for all your work.
It's amazing.
I have FPC and I have tried TWebSocketServer.WebSocketBroadcast(), with several "html" clients and it works very well. Excellent!
I would like not only to have websockets clients "html", but also to add clients made with mORMot.
I tried to do it with "THttpClientWebSockets" but I do not know how to use it.
I appreciate some guidance.
Offline
As I wrote, there is no way yet to broadcast all clients of inteface-based services callbacks.
What is wrong with calling an interface callback in a loop on the server side? It will work even without WebSockets involved...
Anyway, how do you expect it to work with mORMOt clients?
By supplying a custom interface, e.g. ICallbackBroadcast, for the TSQLRestServer.Service?
Offline
Okay. Thanks for the clarification.
I am a newbie, and I wanted my server (TWebSocketServer), to have communication via websockets, at the same time for clients "html" and mORMOt clients.
Offline
Pages: 1