Integration Options
Last updated
import axios from 'axios';
axios.get('https://{the-client-gw-api-here}/api/v2/identity', {
headers: {
'Content-Type': 'application/json',
'x-api-key': '{the-api-key-here}'
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error fetching data:', error);
});// Connect websocket
const socket = new WebSocket('wss:{ddhub-wss-url}', ['ddhub-protocol']);
socket.onopen = () => {
console.log('Connected with subprotocol:', socket.protocol);
};// send message
socket.send(JSON.stringify({
"fqcn": "test.pub.chnl",
"topicName": "test_topic",
"topicVersion": "1.0.1",
"topicOwner": "ddhub.test",
"transactionId": "45d5a89f-7c2c-48b0-ae9a-54f4128e818",
"payload": "{ data: 70 }"
}));// set up a listener for incoming messages
socket.onmessage = function (event) {
const data = JSON.parse(event.data);
console.log('Received:', data);
};