FPoIP WebAPI

Coming soon!

The FPoIP WebAPI Beta will be released soon, subscribe to the Opal Kelly Newsletter to be notified when this is available.

The FPoIP WebAPI provides a JavaScript implementation of the FPoIP protocol, enabling the development of browser-based FPoIP client applications.

Source code for the FPoIP WebAPI is made available under an MIT open source license and can be obtained through Github at opalkelly-opensource/frontpanel-ws. Additional information is available on our WebAPI Reference Guide.

The reference documentation can also be generated by running npm run doc:html with the module sources.

Requirements

The FrontPanel WebAPI is designed for and targets the latest Chrome and Firefox web browsers running on desktop operating systems. The Chrome browser on Android has also been tested and is known to work. At this time web browsers on iOS are not supported or known to be compatible due to issues with WebSockets on these devices.

While other browsers may work, they are not officially supported.

Architecture

An FPoIP WebAPI application consists of several components, some of which are optional. For more information on the client and FPoIP server please refer to the FrontPanel over IP documentation.

Client

The client machine consists of the computer and browser that both loads the WebAPI application and connects to the FPoIP server for device connection. The WebAPI application can be loaded either from a local HTML file, or from a server running on another machine (see WebAPI Server below).

FPoIP Server

The FPoIP server acts as the host for the FrontPanel FPGA module and runs any server side scripts used by the application.

The FPoIP server must be running on a machine that is accessible by the client machine.

WebAPI Server (optional)

A web server can be used to serve an FPoIP WebAPI application.

The WebAPI server software may be run on the same computer as the FPoIP server or an entirely separate machine, so long as it is accessible by the client machine.

Note that the WebAPI server only provides the WebAPI application to the client, it does not need to connect or communicate with the FPoIP server itself.

Examples

  1. A client machine opens an HTML file containing a FPoIP WebAPI application locally, then connects to an FPoIP server running on the same machine through localhost, hosting a FrontPanel board. Note that in this example a single machine is used for every component of the overall architecture.
  2. A client machine connects to a static web server on the internet that serves the application. The client then connects to an FPoIP server running on a machine in the

Protocol

The FPoIP WebAPI is built on the FPoIP protocol. The current FPoIP protocol is an asynchronous protocol in which requests are sent from the client and replied to by the server some time later. As well, the server may send unsolicited replies to the client. These unsolicited replies are used for notifications about server events not corresponding to any client requests (for example, a device disconnection event). Many of these aspects of the FPoIP protocol are abstracted away from the user when using the provided web application framework.

Web Application Framework

To simplify web application development some common functionality for web applications using the FrontPanel interface is provided in the FrontPanelWebAppBase class.

Additional documentation on the Web Application Base class can be found in the API reference.

Setup

The FPoIP WebAPI can be used to build an FPoIP client application using JavaScript. The WebAPI provides a set of familiar functions for interacting with FrontPanel devices through FPoIP by abstracting the underlying websockets requests away from the user.

Installation of the FPoIP WebAPI is handled through NPM, the package manager for node.js. The FPoIP WebAPI can be added to an existing JavaScript application by adding the @opalkelly/frontpanel-ws package to your project. This package can also be installed separately by running npm install @opalkelly/frontpanel-ws.

An FPoIP client built with the WebAPI must connect to an FPoIP server with an available device to make use of the API. For more information on configuring an FPoIP server please see FrontPanel over IP.

Examples

A simple sample application is provided with the FrontPanel WebAPI package. The sample application demonstrates connecting to an FPoIP server and pulling device information from any connected devices that can be opened. Sources for the sample application can be found with the WebAPI source code.

A pre-built version of the WebAPI sample is available here: https://library.opalkelly.com/samples/simple/. Note that use of this sample requires connection to an FPoIP server that is accessible from the client machine running the sample.

In addition to the simple WebAPI sample application, source code for WebAPI versions of the PipeTest and Counters applications are provided with the FrontPanel SDK.

Pre-built versions of the Counters and PipeTest samples can also be accessed through the Opal Kelly website at:

Naming Conventions

The WebAPI follows JavaScript naming conventions. This means that functions and variables use camelCase, constants user UPPERCASE, and classes use PascalCase. Note that this is a departure from the naming conventions used in the rest of the FrontPanel API.