Web based interfaces for instrument control

October 23, 2015

User interface design is never an easy task: it must be cross-platform, easy to install and reactive. The first two points can be easily solved using a browser user interface. Web browsers are already installed on virtually every device (PCs, smartphones, tablets, …). This removes the need of shipping a separate GUI application.

However, browsers seems to lack the reactivity criterion. When working with high-performance instruments, such as photonic sensors, you need to transfer and visualize large amounts of complex data in real-time. The HTTP protocol, which was designed to display static content at a slow refreshing rate triggered by user requests, is far from optimal for such applications. Hopefully, HTML5 comes to our rescue !


The WebSocket protocol

WebSocket is a thin protocol build on top of TCP that has been specifically designed to address the performance issues of HTTP. It provides a performance close to a raw TCP socket, while being compatible with web browsers. In other words, you can combine the high performance of a TCP socket - which is ideally suited for instrument data transfer since data integrity is guaranteed and is very efficient to transfer large buffers - with the convenience of web programming. You can thus open long lasting, bidirectional connections between your instrument and the user browser.

Moreover, once you are inside the browser, you can benefit from the powerful features provided by modern JavaScript frameworks. Some libraries such as d3.js allow you to customize advanced graphics for complex data visualization, whereas a library like Flot.js provides high-performance plotting features ideal for real-time monitoring.

In a future post we will compare possible software stacks on the server side to provide such an interface to the instrument user.