As most things the protocols are plugins/modules in XSockets. This way we (and you) can add custom protocols to connect new "things". You can easily connect anything that has
Responsibility of a protocol
A protocol has two main purposes. First of all it should convert all incoming data into the internal format of XSockets (the
IMessage). The second part is that the protocol should convert all outgoing messages from IMessage back into the format of the protocol.
The process is explained in the image below. The process shows two client and two protocols. The clients use different protocols, but can still communicate with each other. This is possible since the protocols convert the incoming data into a common format (
IMessage). And the outgoing data is converted back to the format that each protocol/client understands.
The picture shows that we have 2 clients. Client A understands circles, and client B understands triangles. Then we have 2 custom protocols, one for circles and one for triangles. Since the protocols responsibility is to convert all incoming messages into a common square format, all client can talk to each other. The yellow part you be seen as a XSockets controller. So regardless of protocol you can have common business logic for the messages regardless of where the message came from, or where it is going.
We call this feature "cross-protocol communication". This is really one of the key features of XSockets since it allows you to connect anything that has TCP/IP to any other thing. We have implemented a few protocols that is shipped with XSockets, but it is pretty easy to implement a custom protocol. We will walk through that under the "custom" section.