Necessity – Plugs and Sockets

Dialog between digital twins is the backbone of the digital ecosystem. This is accomplished in the OtterServer by using plugs and sockets. As their name implies, plugs initiate a connection with a socket. Once connected either twin can prompt the other for dialog.

Twin to Twin Example

The following is an example from the Otter Demo showing a plug actor in one digital twin dialoguing with a socket component in another digital twin.

In this example, the digital twin with a plug connects to a socket of another digital twin in the ecosystem. The InternetPlugTest, a plug component, prompts the external InternetPlugSocket, a socket component, with a request for the dialog GetSysProp. GetSysProp then initiates the prompt, GetPlugMessage, to the component. The response from GetPlugMessage is returned to the socket which then sends it to the connected plug.

Socket and Plug Visualization

The socket access provided to a plug is determined by the security assigned to each plug. The socket access is provided as a composite of all the sockets available to a specific plug.

The following is a visualization of the composite of sockets available to one plug in the OtterDemo:

The center ring separates Refs, references to services, that can be invoked by a plug and the Services, provided by the plug, that can be invoked by a socket. A plug service can only be invoked by the socket if the plug registers the service to the socket.

The next rings out from the center show:

  • The domains that offer services
  • The services offered
  • The dialog to send and receive

Selecting a Send or a Receive will show the structure of the dialog. The following is the send of “ref Order” in the Pizza Stores domain.

Selecting a Send or a Receive will show the structure of the dialog. The following is the send of “ref Order” in the Pizza Stores domain.

The following is the Receive of “ref Order” in the Pizza Stores domain.

The following visual is the composite of sockets for a different plug from the OtterDemo. This composite socket has fewer sockets available.

Assigning sockets to a plug is a security function of the OtterServer. In this example, the plug has less access than the previous plug example.

Internet Browser Plug Component

The OtterServer utilizes the Web Socket Internet standard for all ecosystem communications. This communication establishes a connection for asynchronous messaging.

An Internet browser may function as a plug and initiate prompts to any OtterServer twin. All of the visualizations, tests, and simulations of the OtterServer may be initiated from a standard Internet browser using JavaScript functions included with the OtterServer.

On the initial connection of a plug to a socket, the plug is sent a Service Data Object containing all the information in the plug’s composite socket. With this Service Data Object the OtterServer JavaScript library supports:

  • Invoking a socket reference and receiving a response
  • Registering a plug service
  • Receiving an invoke from a socket and sending a response

Although the OtterServer provides support for JavaScript, any software written in a programming language that supports Web Sockets could be used to access the OtterServer.