Blog

All Blog Posts  |  Next Post  |  Previous Post

Introducing TMS FNC WebSocket

Bookmarks: 

Thursday, October 27, 2022

TMS Software Delphi  Components

Today a new member joins the TMS FNC family: TMS FNC WebSocket!

In TMS FNC WebSocket you'll find easy to use server and client components for WebSocket communication. Both the server and the client implement the RTF 6455 standard for WebSocket Protocol, so the components can be mixed and used with existing WebSocket clients and servers. 

Simply drop them on a form, set the few required properties such as port number and host name and they are ready to connect. Of course, starting up a server that does nothing or connecting to a server without doing anything with the incoming messages is rarely enough so let's take a look at the capabilities!


TTMSFNCWebSocketServer

Receiving and sending messages as one would expect is possible. There are separate events and methods available for text and binary data based messages. You can also broadcast a message to all connected clients or decide yourself which clients should receive the message.

But is it secure? Yes, the TTMSFNCWebSocketServer also supports the WebSocket Protocol over TLS!


TTMSFNCWebSocketClient

Not only the server needs to be able to send and receive messages but also the client. Just like in TTMSFNCWebSocketServer, separate events and methods are available for dealing with text and binary messages. Sending a text message to the server is as simple as:

TTMSFNCWebSocketClient.Send('Hello world');

We also made sure to make TTMSFNCWebSocketClient as compatible with the existing TWebSocketClient component (TMS WEB Core) as possible so you can reuse your existing code without headaches!


WhatsApp webhooks

Along with our new TMS FNC Cloud Pack v2.5 release we added support for sending WhatsApp messages. What about receiving messages?

The WhatsApp Business API requires a webhook to receive messages. Utilizing the power of TTMSFNCWebSocketServer, the TTMSFNCWhatsAppServer allows you to run a server that serves as the callback URL for the WhatsApp Business API. This makes it possible to catch the incoming messages that you are subscribed to.

You can either parse the incoming JSON messages yourself or take advantage of the TTMSFNCWhatsAppServer forwarding these messages for you to the connected TTMSFNCWhatsAppReceiver clients! The TTMSFNCWhatsAppReceiver will do the parsing for you resulting in an object that contains all the message details, such as sender name, phone number, message id, and so on...


WebSockets in action

Can't wait to see WebSockets working in native and WEB environments? Watch this video we prepared for the launch!


Availability?

TMS FNC Websocket is available as a standalone product and as expected, it is also part of TMS ALL-ACCESS and TMS FNC Component Studio.



Tunde Keller


Bookmarks: 

This blog post has received 9 comments.


1. Thursday, October 27, 2022 at 4:25:58 PM

Does it compiles with FPC?
If not, do you plan to make it available for FPC too?

Dimitris Kounalakis


2. Thursday, October 27, 2022 at 4:33:29 PM

Not yet in v1.0.
It''s non-trivial. We''ll check demand for next versions.

Bruno Fierens


3. Thursday, October 27, 2022 at 4:43:47 PM

Could it can transfert the files each others?

stlcours


4. Thursday, October 27, 2022 at 5:04:10 PM

This is really great ! Thanks Bruno.
Is this will replace MQTT at some point ?

Baudewyns Robert


5. Thursday, October 27, 2022 at 6:15:44 PM

I don''t see it as a replacement. MQTT has some characteristics that might be needed in some scenarios that are not in WebSockets.
I see is as just another choice for real-time communications between server and both native & web clients.

Bruno Fierens


6. Friday, October 28, 2022 at 1:04:53 PM

Is there much work in linking the FNC WebSocket client with your MQTT client so we can access MQTT brokers over websockets? That would make your MQTT offering more powerful.

Dave

Akerman David


7. Friday, October 28, 2022 at 2:45:25 PM

I just tried the demos and it is perfect timing for my incoming project.

At version 1.0 , it is looking great.

Looking forward to the updates.

Kamran


8. Friday, October 28, 2022 at 3:07:29 PM

For FPC; what about using mORMot2 websocket implementation there? Is that possible in this context?
https://github.com/synopse/mORMot2/blob/master/src/net/mormot.net.ws.client.pas

https://github.com/synopse/mORMot2/blob/master/src/net/mormot.net.ws.server.pas

https://github.com/synopse/mORMot2/blob/master/src/net/mormot.net.ws.core.pas



Eduard Appelhans


9. Friday, October 28, 2022 at 3:13:39 PM

Hi David,

Interesting suggestion that we have not investigated yet. We''ll need to research this first if and how we could do this integration with MQTT.

Bruno Fierens




Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.



All Blog Posts  |  Next Post  |  Previous Post