Home Reference Source Test Repository
import RealtimeClient from 'jexia-sdk-js/src/RealtimeClient.js'
public class | source

RealtimeClient

Managing real time events

Constructor Summary

Public Constructor
public

Create a new RealTimeClient object with some initial values.

Member Summary

Public Members
public
public
public
public
public
public

Method Summary

Public Methods
public

Attach responsible event handlers

public

get event name without namespace

public

Responsible for handling a new subscription

public

onToken(data: Object)

Responsible for handling a new token

public

setToken(token: string)

Set the current token

Public Constructors

public constructor(options: Object): Promise<JexiaClient, Error> source

Create a new RealTimeClient object with some initial values.

Params:

NameTypeAttributeDescription
options Object

Initial options object

options.url string

url

options.token string

token

options.bus string

Bus

Public Members

public bus: Object source

public curSubscription: string source

public faye: Object source

public subscriptions: Array source

public token: string source

public url: string source

Public Methods

public attachEventHandlers() source

Attach responsible event handlers

Listen:

jexia.auth.token

New token

jexia.dataset.subscription

New dataset subsciption

public getEventWithoutNamespace(event: string): string source

get event name without namespace

Params:

NameTypeAttributeDescription
event string

Event with namespace attached

Return:

string

event - Event without namespace

public onSubscription(data: Object) source

Responsible for handling a new subscription

Params:

NameTypeAttributeDescription
data Object

Subscription response

public onToken(data: Object) source

Responsible for handling a new token

Params:

NameTypeAttributeDescription
data Object

Subscription response

public setToken(token: string) source

Set the current token

Params:

NameTypeAttributeDescription
token string

token