This repository has been archived by the owner on Mar 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Develop with UA Tracker
hamzahalhariri edited this page Jun 15, 2018
·
2 revisions
In your plugin you need to send an event to UA-Tracker agent in with provider name to get your stream
this.ready('se-infomaker-dashboard-ua-tracker', () => {
this.send('se-infomaker-dashboard-ua-tracker:get:stream', {
provider: 'im-demo-writer' //Same provider name that was configured in UA-Tracker config
})
})
to listen to your stream you can send a listener callback function with your create event or listen on stream events
this.send('se-infomaker-dashboard-ua-tracker:get:stream', {
provider: 'im-demo-writer', //Same provider name that was configured in UA-Tracker config
onReadyStateChange: connected => this.connected = connected, //When the stream is started this callback will be called and pass the connection status "true || false"
onStream: uatArticle => console.log(uatArticle), //onStream callback will be called for each Writer article is opened/closed/locked/unlocked
onError: error => console.log(erorr), // onError callback will be called when something wrong happened with the connection
})
this.on('se-infomaker-dashboard-ua-tracker:isReady', connected => {
// This event will be fired everytime when UA-Tracker connected || disconnected
this.connected = connected //true || false
})
...
this.on('se-infomaker-dashboard-ua-tracker:on:stream', uatArticle => {
// This event will be fired for each Writer article is opened/closed/locked/unlocked
// Do stuff with uatArticle ....
})
...
this.on('se-infomaker-dashboard-ua-tracker:on:error', error => {
// This event will be fired if something went wrong with connection
console.log(error)
})
...
this.send('se-infomaker-dashboard-ua-tracker:get:stream', {
provider: 'im-demo-writer' //Same provider name that was configured in UA-Tracker config
})
{
"uuid": "952efed7-05cb-4ba2-afd1-65dwf1158383",
"customerKey": "im-demo-writer",
"lockedBy": "jqZC5Ies2vq_15K0BGDS",
"users": [
{
"uuid": "952efed7-05cb-4ba2-afd1-65dwf1158383",
"timestamp": "1518422596915",
"socketId": "jqZC5Ies2vq_15K0BGDS",
"customerKey": "im-demo-writer",
"name": "Hamzah Al Hariri",
"email": "hamzah.alhariri@infomaker.se"
}
]
}
You can send a notify event to all users who has the artcile opened in Writer. example: will notify users who has article opened with articleUUID property, and wil passed Dashboard username as an identifier
this.send('se-infomaker-dashboard-ua-tracker:send:notify', {
articleUUID: "952efed7-05cb-4ba2-afd1-65dwf1158383"
})
To delete a stream just send an event with an empty object:
this.send('se-infomaker-dashboard-ua-tracker:delete:stream', {})