Home Reference Source
import WebsocketDatasource from 'proteic/src/datasources/WebsocketDatasource.js'
public class | source

WebsocketDatasource

Extends:

Datasource → WebsocketDatasource

This datasource set up a connection to a websocket server.

Constructor Summary

Public Constructor
public

constructor(source: any)

Creates an instance of WebsocketDatasource.

Member Summary

Public Members
public
public

source: *

public

ws: *

Method Summary

Public Methods
public

configure(dispatcher: any)

Configure a dispatcher for this datasource.

public

start()

Initialize a websocket connection

public

stop()

If started, this method close the websocket connection.

Inherited Summary

From class Datasource
public

filters: *

public

filter(filter: any): *

Filters the incoming messages.

public

start()

Starts the stream of data

public

stop()

If started, this method stops the stream of data

Public Constructors

public constructor(source: any) source

Creates an instance of WebsocketDatasource. This datasource will try to connect to the speficied websocket endpoint.

   var source = {
     endpoint: 'ws://192.168.3.32:3000/pathToWebsocketEndpoint';
   };

   linechart = new proteic.Linechart(new proteic.WebsocketDatasource(source));

If new data is available, this datasource will forward the data records to the chart, which automatically repaint the chart with these new records.

Override:

Datasource#constructor

Params:

NameTypeAttributeDescription
source any

A websocket endpoint. If invalid, this class will throw an Error.

Public Members

public dispatcher: * source

public source: * source

public ws: * source

Public Methods

public configure(dispatcher: any) source

Configure a dispatcher for this datasource.

Params:

NameTypeAttributeDescription
dispatcher any

A d3 dispatcher. This dispatcher is in charge of receiving and sending events.

public start() source

Initialize a websocket connection

Override:

Datasource#start

public stop() source

If started, this method close the websocket connection.

Override:

Datasource#stop