Home Reference Source Repository
import WebsocketExposer from 'schema-mapper-store/lib/expose/websocket.js'
public class | source

WebsocketExposer

A server that handles websocket connections via SockJS

Constructor Summary

Public Constructor
public

constructor(config: Object, storeProxy: StoreProxy)

Create a new WebsocketExposer instance

Member Summary

Public Members
public

A map containing all connected clients

public

A stream that handles commands from clients

public

Restify server

public

Proxy to communicate with the store

Method Summary

Public Methods
public

fanout(topic: String, data: Object)

Send a event to all connected clients

public

Create a command stream

public

setupStream(server: Server, uri: String)

Create a SockJS server (via shoe) and handle incoming connections

Public Constructors

public constructor(config: Object, storeProxy: StoreProxy) source

Create a new WebsocketExposer instance

Params:

NameTypeAttributeDescription
config Object

Configuration

storeProxy StoreProxy

Proxy to communicate with the store

Public Members

public clients: Object source

A map containing all connected clients

public commandStream: Stream source

A stream that handles commands from clients

public server: Server source

Restify server

public storeProxy: StoreProxy source

Proxy to communicate with the store

Public Methods

public fanout(topic: String, data: Object) source

Send a event to all connected clients

Params:

NameTypeAttributeDescription
topic String

Event topic

data Object

Event data

public setupCommandStream() source

Create a command stream

public setupStream(server: Server, uri: String) source

Create a SockJS server (via shoe) and handle incoming connections

Params:

NameTypeAttributeDescription
server Server

Server object to bind the websocket server to

uri String

Uri to mount the websocket server to