Until now, PI Web API has been strictly a request-response developer technology. You make a request to the PI Web API server and it responds. This is fine so far, but you have asked us for a way to let your applications know when PI System data values have changed. In PI Web API 2015 R3, we will release a Community Technology Preview (CTP) of Channels. This is our name for a technology that will send new and changed data values to your application through web sockets.

 

Web sockets behave much like TCP sockets except that they are initiated with an HTTP request from a client. Once open, the server is free to send unsolicited data to the client. As with REST services, there are a number of client libraries available for many languages and platforms to consume data from web sockets.

 

To open a web socket to a single AF Attribute or PI Point, you would submit this:

 

wss://myhost.com/piwebapi/streams/{webId}/channel

 

The protocol identifier is "wss" which means secure web sockets (equivalent to "https"). Once open, you will get a payload from the PI Web API server whenever new or changed data values arrive. The design of the payload in this example is the same as the streams/{webId}/end function. This means you can use the code you already have to process updates from your web socket. We also support updates from: (A) all Attributes of an Element or Event Frame (equivalent to /streamsets/{webId}/end), and (B) updates from an unrelated set of Attributes or PI Points (equivalent to /streamsets/end).

 

Since the Channel open request is a standard HTTP request, we can support URL parameters. One of them will be includeInitialValues, a boolean which defaults to false. If true, the PI Web API Server will respond with current values for all Attributes or PI Points in its first response. Use this with care because this could generate a lot of data!

 

There's a lot of detail still to share. We'll post more detailed documentation and code samples soon. As I said, the feature will be released as a CTP within the PI Web API 2015 R3 release in October. What CTP means is that we will make the feature available but reserve the right to change the design based on your feedback.