import WebsocketDatasource from 'proteic/src/datasources/WebsocketDatasource.js'
WebsocketDatasource
Extends:
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 |
dispatcher: * |
|
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 |
properties: * |
|
public |
convert(data: *): * |
|
public |
filter(filter: any): * Filters the incoming messages. |
|
public |
property(prop: *, newProp: *, cast: *): * |
|
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#constructorParams:
Name | Type | Attribute | Description |
source | any | A websocket endpoint. If invalid, this class will throw an Error. |
Public Methods
public configure(dispatcher: any) source
Configure a dispatcher for this datasource.
Params:
Name | Type | Attribute | Description |
dispatcher | any | A d3 dispatcher. This dispatcher is in charge of receiving and sending events. |
public stop() source
If started, this method close the websocket connection.