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

HTTPDatasource

Extends:

Datasource → HTTPDatasource

This datasource set up a connection to a http server.

Constructor Summary

Public Constructor
public

constructor(source: any)

Creates an instance of HTTPDatasource.

Member Summary

Public Members
public
public
public

source: *

public

Method Summary

Public Methods
public

configure(dispatcher: any)

Configure a dispatcher for this datasource.

public

start()

Initialize an HTTP connection

public

stop()

If started, this method close the HTTP connection.

Inherited Summary

From class Datasource
public

filters: *

public
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 HTTPDatasource. This datasource will try to connect to the speficied HTTP endpoint.

   var source = {
     endpoint: 'https://randomuser.me/api';
   };

   linechart = new proteic.Linechart(new proteic.HTTPwDatasource(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

An http endpoint. If invalid, this class will throw an Error.

Public Members

public dispatcher: * source

public intervalId: * source

public source: * source

public started: boolean 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 an HTTP connection

Override:

Datasource#start

public stop() source

If started, this method close the HTTP connection.

Override:

Datasource#stop