How to implement web ports on the embedded device server?

I work with an electronics manufacturer to implement LAN-based control systems. The idea is to serve the system configuration / management interface through a web browser, so customers never need to install software. We can communicate with the device by sending and receiving serial data through the built-in module. Since the device can also be controlled using the front panel interface, this creates a problem for synchronizing the remote web interface with very low latency. It seems that web interfaces or some kind of Push is what we need to process events in real time from the server to the clients.

I am using the Lantronix Mathport AR Embedded Server. Out of the box, the device will serve any custom HTML and Java servlets / applets. We have the opportunity to install a lightweight Linux distribution if we need more flexibility. I'm not sure how to implement any applications on the server side, since the standard Apache does not work on the device. I believe that he uses Boa.

Can someone lead me in the right direction how to do this?

+4
source share
3 answers

Some general information ... The WebSocket protocol ( draft here ) is a simple layer on top of TCP. This means that if you already have a TCP server for your platform, implementing WebSocket is only a few hours. The protocol defines a handshake and two ways to send data frames.

I highly recommend starting by reading the 39 page specification.

+2
source

As mentioned in Tihauan, start by reading the specs and also note that there are still some changes, although websites are now more stable than a year ago.

The key point for me was the requirement that the websocket data be fully UTF-8 text that lends itself well to JSON-based message descriptions.

Our system uses embedded linux, so we added and used the following libraries:

Using the above as support libraries, we created an internal lightweight โ€œclient / serverโ€ that allowed our other software modules to register for specific, applicable messages on the network and respond as needed. It works great.

Good luck and best wishes,

+2
source

I was a bit late, but Mozilla published a guide called "Writing WebSocket Servers," which literally walks you through writing a web socket server.

You will need to already know how HTTP works, and have an average programming experience. Depending on language support, knowledge of TCP sockets may be required. The purpose of this guide is to provide the minimum knowledge required to write a WebSocket server.

https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers

0
source

Source: https://habr.com/ru/post/1300219/


All Articles