Documentation
Getting started
Steps to set upInstall Live Alert Browser Page for: Google Chrome or Firefox (not yet available)
- Set up your tool:
Browser plugin API
Description
The server requires use the WebSocket protocol.Server
←→
Client (browser plugin)
Request data
Basic structure
{
action: string,
message: [{
label: string|object,
message: string,
}]
}
Full structure (using custom label style)
{
action: string,
message: [{
label: {
style: {
backgroundColor: string,
color: string
},
name: string
},
message: string,
}]
}
Key | Required | Type | Description |
---|---|---|---|
action | required | String | This value live_alert - the action for live alert. You need to enable the «Visual notification» or «Sound notification» switch in the browser plugin settings. |
message | required | Array | Data to be displayed on the browser page. |
message | |||
Key | Required | Type | Description |
---|---|---|---|
label | required | Object|String | Data for label. |
message | required | String | Data for a message. In the formatters we use text data in HTML for a nice display. |
message.label | |||
Key | Required | Type | Description |
---|---|---|---|
style | required | Object | Custom label style. |
name | required | String | Label name. |
message.label.style | |||
Key | Required | Type | Description |
---|---|---|---|
backgroundColor | required | String | Background color of the label. |
color | required | String | Font color of the label. |
Examples
Send live alert to browser page
const data = {
action: 'live_alert',
message: [
{ label: 'My label-1', message: 'My message-1.'},
{ label: 'My label-2', message: 'My message-2.'}
]
};
// client.send(JSON.stringify(data));
Using custom label style.
const data = {
action: 'live_alert',
message: [{
label: {
style: {
backgroundColor: '#ff0000',
color: '#ffffff'
},
name: 'Error'
},
message: 'My message...'
}]
};
// client.send(JSON.stringify(data));
Using a very simple formatter.
const data = {
action: 'live_alert',
message: [{
label: {
style: {
backgroundColor: '#ff0000',
color: '#ffffff'
},
name: 'Error'
},
message: '<br>'
+ 'File: ' + err.file + '<br>'
+ 'Line: ' + err.line + '<br>'
+ 'Column: ' + err.column + '<br>'
+ 'Reason: ' + err.reason + '<br>'
+ 'Name: ' + err.name
}]
};
// client.send(JSON.stringify(data));