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:
-
Download the Websocket App folder{:target=“_blank”}.
-
Unzip the folder:
-
MacOS:
-
In Terminal, execute the command to add execute permission for the
websocket-macosfile:chmod +x {PATH}, wherePATHis the complete path ofwebsocket-macosfile insideNodejsfolder inWebsocket App.Example:
chmod +x /Users/Downloads/Websocket App/Nodejs/websocket-macos -
Open the
websocket-macosfile
-
-
Windows:
- Open
websocket-win.exeinside theNodejsfolder in Websocket App.
- Open
-
-
Open the
index.htmlfile 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:
- Open the
index.htmlfile in the browser. - 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)
- Click Connect.
- 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:
-
Open the
index.htmlfile in the browser. -
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
-
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 ENOTFOUNDerror will be populated. - When the provided action and the endpoint does not match
Action and Endpoint does not matcherror displays. - When the provided event details are incorrect the
Unauthorized to consumeerror will be displayed after polling.