5.0.4 • Published 5 years ago

@pubkeeper/brew-websocket v5.0.4

Weekly downloads
1
License
UNLICENSED
Repository
github
Last release
5 years ago

Pubkeeper WebSocket Brew

Installation

In a browser:

<script src="pubkeeper-brew-websocket.js"></script>

Using npm:

$ npm install --save @pubkeeper/brew-websocket

Then, load using ES5 require() syntax…

var WebSocketBrew = require('@pubkeeper/brew-websocket').WebSocketBrew;

…or with ES2015+ import syntax:

import { WebSocketBrew } from '@pubkeeper/brew-websocket';

Usage

Simple example, pointing to localhost

const wsb = new WebSocketBrew({
  brewerConfig: {
    hostname: '127.0.0.1',
    port: 8080,
    secure: false,
  },
});

With multiple servers…

const wsbLocal = new WebSocketBrew({
  name: 'websocket-local',
  brewerConfig: {
    hostname: '127.0.0.1',
    port: 8080,
    secure: false,
  },
});

const wsbShared = new WebSocketBrew({
  name: 'websocket-shared',
  brewerConfig: {
    hostname: '10.10.0.21',
    port: 443,
    secure: true,
  },
});

const brews = [wsbLocal, wsbShared];

WebSocketBrew Class

The WebSocketBrew provides the connection management layer to publish to and read from the Pubkeeper WebSocket server.

new WebSocketBrew(options)

NameTypeDescription
optionsBrewOptionsThe options for this pubkeeper client
BrewOptions : object

These options can be given to a WebSocketBrew to customize its behavior.

NameTypeDefaultDescription
namestring'websocket'brew name/id
brewerConfigBrewerConfig?nullThe brew's brewer configuration
loopbackbooleantrueEnable/Disbale loopback messages
maxRetriesnumber7Maximum number of connection retries
maxTimeoutnumber10000Maximum timeout between retries (in milliseconds)
BrewerConfig : object
NameTypeDescription
hostnamestringhostname of the WebSocket server
portnumberport of the WebSocket server
securebooleanuse wss:// or ws:// for server communication

Members

.name : string

Return the configured name of this brew.

5.1.3

5 years ago

5.1.2

5 years ago

5.1.1

5 years ago

5.1.0

5 years ago

5.0.4

5 years ago

5.0.3

5 years ago

5.0.2

5 years ago

5.0.1

5 years ago

5.0.0

5 years ago

5.0.0-rc.5

5 years ago

5.0.0-rc.4

5 years ago

5.0.0-rc.3

5 years ago

5.0.0-rc.2

5 years ago

5.0.0-rc.1

5 years ago

5.0.0-rc.0

6 years ago

5.0.0-alpha.4

6 years ago

5.0.0-alpha.3

6 years ago

5.0.0-alpha.2

6 years ago

5.0.0-alpha.1

6 years ago

4.0.1

7 years ago

4.0.0

7 years ago

3.1.0

7 years ago

3.0.0

7 years ago

3.0.0-rc.0

7 years ago

3.0.0-beta.3

7 years ago

3.0.0-beta.2

7 years ago

3.0.0-beta.1

7 years ago

3.0.0-alpha.5

7 years ago

3.0.0-alpha.4

7 years ago

3.0.0-alpha.3

7 years ago

3.0.0-alpha.2

7 years ago

3.0.0-alpha.1

7 years ago