WebSocket is not only for web pages, but is good for embedded M2M connectivity as well.
WebSocket is often called as the TCP socket of the Web. And that’s pretty much correct. WebSocket provides full-duplex communication channel in between WS client and WS server. Roles of client and server are relevant only when establishing connection, when communicating it’s irrelevant, as both sides can transmit independently, just like in traditional TCP/IP sockets.
What makes WebSocket good for Embedded M2M? Well, first of all, it’s standardized, free, and open. It reduces your code size, in case of having both human interface and machine interface, as the same communication module can be utilized for purposes. Most importantly, it gives new freedom in constellation of functionality.
In the old school web architecture, specific application logic was only accessible to client through web server. This means the server must be capable enough to handle that kind of communication, and provide an interface of some sort for application logic integration. Generally speaking, in order to run such a capable web server, a proper CPU w/MMU and a real operating system is needed. We’re talking about something like Espotel Jhumar platform or similar, a device with ARM9 CPU running Linux.
|Traditional web architecture.|
Our engineers have demonstrated running web server and an application logic with WebSocket support in a Cortex-M0 MCU. I have done that same by myself with Arduino platform. That’s the proof of simplicity. Even the most low-end hardware can do Internet-of-Things, with help of HTML5 technology. If strong authentication and security is needed, then HW requirement is upgradedup to Cortex-M4 or higher, depending on availability of cryptographic subsystem.
I have recognized 4 different scenarios how to distribute web server and application logic, illustrated in the picture below.
|Different WebSocket architecture options|
- Integrated - Both server and application logic resides in the same hardware. Stand-alone all-in-one solution.
- Pre-loaded – HTML/JS code is pre-loaded in client side, sort of Apps approach. Most lightweight.
- Cloud wed – Web service is located in cloud, and data is exchanged directly with embedded device. Easy deployment of new UI features.
- Cloud hub – All traffic is routed through cloud. Access through firewalls, and in case of mobile and non-static IP end-points.