Skip to content

Websocket application

A Websocket application is available to demo and manually interface with Trimble Event Service. This application abstracts the Event Service SDK helps it easy to consume or publish events via a Websocket connection. The application becomes dormant after 1 hour of inactivity. The actual implementation of the SDK is necessary to integrate your application with an event topic.

To download the Websocket app:

  1. Download the Websocket App folder{:target=“_blank”}.

  2. Unzip the folder:

    • MacOS:

      1. In Terminal, execute the command to add execute permission for the websocket-macos file: chmod +x {PATH}, where PATH is the complete path of websocket-macos file inside Nodejs folder in Websocket App.

        Example: chmod +x /Users/Downloads/Websocket App/Nodejs/websocket-macos

      2. Open the websocket-macos file

    • Windows:

      1. Open websocket-win.exe inside the Nodejs folder in Websocket App.
  3. Open the index.html file inside the React application folder.

To publish and consume Websocket events, the Nodejs server (websocket-macos or websocket-win.exe) must be running in the background and should not be terminated in the middle.

To publish events:

  1. Open the index.html file in the browser.
  2. Select Action as publish and complete the event details:
    • Endpoint
    • Event Name
    • Namespace
    • Version
    • Publisher Application Client ID
    • Publisher Application Client Secret
    • Publisher Application Scope
    • TID Endpoint(Example: For preproduction app, https://stage.id.trimblecloud.com/oauth/token)
  3. Click Connect.
  4. Once the connection is established it will be redirected to the page to enter payload and send messages.

Acknowledgment and the corresponding error messages if any, will be displayed for each message.

To consume events:

  1. Open the index.html file in the browser.

  2. Select Action as consume and fill the event details:

    • Endpoint
    • Event
    • Namespace
    • Version
    • Consumer Application Client ID
    • Consumer Client Secret
    • Consumer Scope
    • TID Endpoint (Example: For preprod App, https://stage.id.trimblecloud.com/oauth/token)
    • TPS
  3. Click Connect.

You can start and stop polling messages once the connection established successfully.

Where to expect error messages:

  • When the provided endpoint is not valid, the getaddrinfo ENOTFOUND error will be populated.
  • When the provided action and the endpoint does not match Action and Endpoint does not match error displays.
  • When the provided event details are incorrect the Unauthorized to consume error will be displayed after polling.