JNIOR WebSocket Introduction

Easily create your own Web Apps to interact with the JNIOR! The JNIOR WebSockets JavaScript Library is just what the name suggests. It is a library written in Javascript that will aid you in interacting with the JNIOR’s WebSocket Server. The WebSocket server provides access to all of the internal features on the JNIOR including access to the I/O, registry, and file system. You can even pump messages directly to Java applications running on the JNIOR.

The JANOS Web Server listens for connections from clients that are running one of the many popular browser programs. Typically ports 80 and 443 (for secure TLS/SSL communications) are open for connection although those are configurable through the JNIOR Registry. In addition to the default HTTP Protocol a connection may also utilize the Websocket Protocol as described in this document. The Web Server ports are shared by these two protocols. This provides for access to status information and control commands that previously were only available through the JNIOR Protocol. While the JNIOR Protocol remains a viable option for these functions the Websocket approach offers seamless integration into the dynamic web page environment. This capability is new to the Series 4 JNIOR products (Models 410, 412, and 414).

The library discussed below is designed to help you interact with the JNIOR WebSocket server more easily and at a higher level. You can write the web-socket code yourself if you like.


To remotely control the JNIOR you need the ability to obtain I/O status and to affect changes in I/O condition. In the earlier Series 3 JNIOR, this was accomplished through the JNIOR Protocol made available through a TCP/IP connection typically on port 9200. This is a documented binary protocol that requires special programming external to the JNIOR for its use. Care is also required to allow access to the specific port through routers and firewalls. Once successfully implemented the JNIOR Protocol not only provided I/O status and control mechanisms. It also opened access to the JNIOR Registry and thereby the ability to configure and manage the product.

In addition to the JNIOR Protocol, it was also necessary to access the JNIOR Command Line through Telnet. Care again is required to allow access to the Telnet port (Port 23) through routers and firewalls. The Command Line is also accessible using a serial connection to the RS-232 port on the JNIOR. This Console connection provides tools for monitoring I/O status and affecting I/O conditions as well as the use of various kinds of diagnostics. Furthermore, in this environment, the product can be fully configured in all aspects including the network parameters. In addition, this is where application programs can be executed which extend the functionality of the JNIOR product.

Management of the JNIOR also requires the manipulation of files in the local file system. While files may be manipulated through a Console connection transfer to/from an external system is done using FTP. Again care must be taken to allow access to the FTP command port (Port 21) through routers and firewalls. FTP typically opens/accepts data connections which must also be accommodated by the network.

With the introduction of the Series 4 JNIOR running the JANOS operating system, the various I/O and management requirements covered by these other protocols can be additionally handled through a single Web Server connection. Access to the Web Server is typically through ports 80 and 443. The latter connection provides for TLS/SSL up to 256-bit security. While these ports would also need to be accommodated by routers and firewalls this is a much more standard requirement and often routine request for IT personnel. This consolidation of functionality is accomplished using the WebSocket Protocol as specified by the Internet Engineering Task Force (IETF) in combination with JANOS server-side scripting. This can result in a fully functional browser-based dynamic website providing JNIOR monitoring and control. The example is the configuration pages provided with the product. These Javascript[TM] based dynamic web pages have replaced the Java-based applets used by the Series 3 JNIOR products.

Protocol Overview

Most computer languages today accommodate programmatic connection to Web Servers in one fashion or another. It makes sense since the majority of applications developed today involve networking and therefore access to the vast range of data available through the Internet. These web applications needed some form of bi-directional communication between the client and server. For a time programmers attempted to get the job done through an abuse of the HTTP Protocol. A simpler solution has been provided in the form of a WebSocket API which has been quickly accommodated. As a result, most web-based programming environments support Websocket connections and the programmer can utilize them as easily as any other web protocol.

Briefly, the client makes a connection to a JANOS Web Server port. This port expects a valid HTTP connection but is also shared by the WebSocket protocol. Transparently behind the scenes, the connection issues the appropriate HTTP headers requesting an ‘upgrade’ to the WebSocket protocol. When the handshake is complete the connection will be ready to handle bi-directional WebSocket messaging. The JANOS Web Server supports a built-in WebSocket service with messaging that can be used to monitor, control, and manage the Series 4 JNIOR. The built-in service employs JSON message formatting.

To provide additional flexibility the JANOS WebSocket connection can, through a parameter in the URL, be redirected to an application running on the JNIOR. In this case, WebSocket messages are routed through the JANOS inter-process messaging mechanism to the application program. The program uses the same messaging system to provide replies and messages outward through the WebSocket connection. In this fashion, a completely custom messaging system can be implemented.


Any protocol providing control and management functions must employ some form of security preventing unauthorized access and disturbance. In addition to being available through a TLS/SSL secure connection, the built-in JANOS Websocket implementation requires authentication. The authentication handshake must be completed before any operations for monitoring, control, and management will be allowed. This login uses active JANOS user accounts and subsequent operations adhere to the account permissions assigned by the administrator.

To facilitate the seamless use of the WebSocket protocol in the implementation of dynamic web pages a mechanism is provided that utilizes any website authentication completed by the browser to pre-authorize the WebSocket connection. This ensures that only a single entry of login credentials is required to bring up a fully functional and secure dynamic website served by the JNIOR. Note that custom applications running on the JNIOR that serve WebSocket connections are free to implement or ignore any kind of authentication requirement.

By | Updated On February 26, 2024 4:15 pm | No Comments | Categories: | Tags:

INTEG Process Group, inc. © 2023

Mon - Fri, 8am - 4pm EST
P: 724-933-9350
Always Available
Contact Form