Documentation

Getting started

Steps to set up
  1. Install Live Alert Browser Page for: Google Chrome or Firefox (not yet available)

  2. Set up your tool:

Browser plugin API

Description

The server requires use the WebSocket protocol.
Server
←→
Client (browser plugin)
When the server is started and the connection is established with the browser plugin, the following requests can be used on the server.

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,
    }]
  }  

KeyRequiredTypeDescription
actionrequiredStringThis value live_alert - the action for live alert. You need to enable the «Visual notification» or «Sound notification» switch in the browser plugin settings.
messagerequiredArrayData to be displayed on the browser page.
message
KeyRequiredTypeDescription
labelrequiredObject|StringData for label.
messagerequiredStringData for a message. In the formatters we use text data in HTML for a nice display.
message.label
KeyRequiredTypeDescription
stylerequiredObjectCustom label style.
namerequiredStringLabel name.
message.label.style
KeyRequiredTypeDescription
backgroundColorrequiredStringBackground color of the label.
colorrequiredStringFont 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));