3 Networking
Kristóf Tóth edited this page 2019-12-19 13:47:09 +01:00

The foundation of the whole framework is the messaging system connecting the frontend with the backend. Frontend components use websockets to connect to the TFW server, to which you can hook several event handlers defining how to handle specific messages.

Note that a nice overview of the framework networking is included in this blog post, which you should read.

ZMQ

Event handlers connect to the TFW server using ZMQ. They receive messages on their SUB(scribe) sockets, which are connected to the PUB(lish) socket of the server. Event handlers reply on their PUSH socket, then their messages are received on the PULL socket of the server.

Named pipes

There is another layer on top of ZMQ sockets called named pipes. These are an extension of traditional Unix pipes, and they represent a FIFO-like structure. They behave similarly to files except that you cannot seek in them. Their role in the framework is to allow users to read and write TFW messages in JSON format without any additional libraries. This way you can implement an event handler even in bash without much effort.