Skip to Content

As SSCE is available in 15.x version of MII and there could be a need to subscribe tags using WebSocket in previous version as well, below blog would help you do it with any version of MII and for that matter without MII as well. You just need SAP Plant Connectivity (PCo) version that provides web socket server.

SAP Plant Connectivity provides a feature that allows users to use SAP PCo’s WebSocket server from any application using standard WebSocket object available in JS. As there is no document mentioning step by step configuration details, below blog would help you quickly configure PCo and subscribe to tags from an application.

The steps are:

  1. Configuring a Source system.

I selected OPC UA source system and provided requisite details viz. Server End point and                  credentials. You can use any source system type which supports WebSocket.

Figure 1 Add Source System

Figure 2 Add credentials to source system

I have used username/password authentication but you have a choice to select authentication            mode as per your preference.

Test the connection, it should be connected successfully.

  1. Create agent using above created source system.
    • Go to server tab of agent configuration screen and select WebSocket Server.

Figure 3 Select Server Type

  • Provide an available TCP/IP port.
  • In Maintain Destination System for WebSocket section, click on Create Destination System. This would create a destination system for WebSocket so that you can subscribe to it.

Figure 4 Create Destination System

  • Go to Subscription Items Tab and click on browse button given at bottom left. Select the tags your want to subscribe and hit Ok.

Note: If you are just using WebSocket, then you need not add subscription items as you would be sending Tag Name from the web application. It is required only when you are using Static Notifications.

Figure 5 Add Subscription Items

  1. Create a notification using this agent.
    • Select the type of notification as “Notification Template for Remote Subscription”.

`         

Figure 6 Create Template Notification

  • Provide name and description.
  • Go to Destinations tab of notification and click on add destination system. Following option would be available as “Destination System for WebSocket”.

Figure 7 Add Destination for Template Notification

Provide name and description (optional) and click on Ok. Destination system should be added as shown below.

Figure 8 Destination Selection

  1. Start the agent. It should show message as “Agent started Successfully.”

Figure 9 Agent Started Successfully

  1. Configuration from SAP PCo side is complete.
  2. Now you can subscribe to web socket using : ‘ws://<server>:<WebServer Port configured in PCo>/<DestinationName configured in notification template>’
  3. Input/message to WebSocket should be as shown below. Please refer to PCo help document “JSON Messages for WebSocket Connections” for further details of messages and structures.

{

“Action”: “Subscribe”,

“Params”: {

“Template”: “<Notification Template Name>”,

“TagNames”: [

{

“Name”: “<TagGroup> /<TagName1>”,

“IsNative”: true,

“Alias”: “rand2”

},

{

“Name”: “<TagGroup> /<TagName2>”,

“IsNative”: true,

“Alias”: “Rand11”

}

]

}

}

  1. Please note, the delimiter between TagGroup and TagName in message should be “/” and not “.”.
  2. With this, you should be able to make use of WebSocket() object and subscribe to your tags using PCo WebSocket server.
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply