1.0.5 • Published 3 years ago

@david.uhlir/mesh v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Mesh broadcast for node.js server applications

Implementation of broadcast server/client for node.js server applications. It provides you ability to broadcast message across mesh network, defined simply by connection between nodes. It's communicating by websocket.

Every each node can has more fallback addresses, that will be used when current connection fails. Communication between nodes is realized by proxing message on each node depends on target position in mesh. Also there can be specified trace for every each message, to optimize transfer speed, standarty it using the shortest posible way.

Connection is secured by secret, that is configured on each server. In URL of node, it needs to be specified before url, separated by @.

Example of service:

import { BroadcastService, BROADCAST_EVENTS } from '@david.uhlir/mesh'

(async function() {
  const network = new BroadcastService({
    nodesUrls: [ 'some-secret@ws://123.456.789.255:3000/'],
    serverPort: 3000,
    serverSecret: 'some-secret',
  })
  // initialize connections
  await network.initialize()

  // listen received message
  network.on(BROADCAST_EVENTS.MESSAGE, (message) => console.log('Received message', message))

  // broadcast message to all, on every each change
  network.on(BROADCAST_EVENTS.NETWORK_CHANGE, () => network.broadcast({ someText: 'Hello world' }))
})()

ISC

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago