Subscriptions

Prerequisites

  • Ability to establish a WebSocket connection using any programming language or tool that support the WebSocket protocol 

About Subscriptions 

Subscriptions are a source of on-the-fly real-time Manifest data access. Using subscriptions in an external system clients can get real-time updates on changes inside of the Manifest platform without the necessity to make extra requests.  

How to Set-up Subscriptions 

  • To establish connection to GraphQL subscriptions from a source outside Manifest a WebSocket protocol usage is required.  
  • Use the following connection string in your WebSocket library or tool to establish connection: 
    • <protocol>://<subdomain>.<host>/socket.io.v4/?transport=websocket&EIO=4&token=<jwt_token>&<parameters>” 
  • Below shows what should be included in the following connection string in order to establish connections:  
    • <protocol>: “wss” is used to establish a secure TLS connection. Use “ws” for On-Premise Docker connection. 
    • <subdomain>: e.g. “clientname”, use your subdomain here. 
    • <host>: “taqmanifest.com” or a different host you are working at. Use “localhost” for On-Premise Docker connection. 
    • <jwt_token>: JWT token of any authorized on the subdomain. 
    • <parameters>: entities IDs or names that you need to get updates for. If you want to use multiple subscriptions – join them using & (ampersand sign). Boolean type parameters should have value of “true” to get subscription. 
  • Below are examples of the subscriptions you can get updates for:  
    • newAsset<Boolean> – subscribe to all new Assets created; 
    • newMeasurement<Boolean> – subscribe to all new Measurements created; 
    • jobForAssetId<Integer> – subscribe to all new Jobs created referencing the Asset with ID that you specify as parameter value; 
    •  jobOnLocationId<Integer> – subscribe to all new Jobs created referencing the Location with ID that you specify as parameter value; 
    •  faultOnLocationId<Integer> – subscribe to all new Faults set on Jobs on the Location with ID that you specify as parameter value; 
    •  assetId<Integer> – subscribe to all updates of the Asset with ID that you specify as parameter value; 
    •  jobId<Integer> – subscribe to all updates of the Job with ID that you specify as parameter value; 
    •  userId<Integer> – subscribe to all updates of the User with ID that you specify as parameter value; 
    •  measurementId<Integer> – subscribe to all updates of the Measurement with ID that you specify as parameter value; 
  • Additional events need to be set up using your WebSocket library or tool:  
    • Send a single event with string data equal to “40” after connection is established 
    • Upon every event with string data equal to “2” send an event with string data equal to “3” 

Example connection string:  

“wss://client.taqmanifest.com/socket.io.v4/?transport=websocket&EIO=4&token=JWT%203y4r3andsoon&newAsset=true&userId=321&jobOnLocationId=2474” 

Table of Contents
    Add a header to begin generating the table of contents