Hi,
Using Webservices as middleware in TMS XData, how can I identify individual clients?
I need to send messages to different clients depending on the situation, but I need to identify them and send messages only to them.
I don't find the same handling as FNCWebsocket.
Is there a way to achieve this, or is Xdata's webservice management quite basic?
Thanks
You identify the client the same way you do in a regular XData server: authenticating them, usually via JSON Web Token sent in the Authorization HTTP header, but your free to use any kind of authentication, Basic Authentication, or any other mechanism.
WebSockets is just an addition to existing HTTP and most of what works with Sparkle (middleware) also works with WebSockets the same way.
You can also save in some global storage the IWebSocket interfaces you create to communicate with clients. Then just use the proper interface to send the message to the client you want.
It's clearer now, and I'm happy that the management is the same as Xdata (using the same JWT authentication logic, in my case), but I thought there was already a ready-made structure for management. I understand that I need to build a "clients" objectlist myself that implements an Iwebsocket property, to be used (if still active) when I want to respond to a specific object (client) in the list. Or am I wrong?
Thanks
Yes, that is correct.