Skip to content

Documentation / @super-line/server / MemoryBus

Class: MemoryBus

Defined in: memory-adapter.ts:9

In-process pub/sub bus. Share one bus across multiple servers to simulate multiple nodes in a test (each server gets its own adapter bound to the bus). The presence directory also lives here, so servers sharing a bus see the whole cluster (mirroring how Redis is shared in production).

Constructors

Constructor

new MemoryBus(): MemoryBus

Returns

MemoryBus

Properties

descriptors

readonly descriptors: Map<string, ConnDescriptor>

Defined in: memory-adapter.ts:12

Methods

publish()

publish(channel, payload): void

Defined in: memory-adapter.ts:30

Parameters

channel

string

payload

string | Uint8Array<ArrayBufferLike>

Returns

void


subscribe()

subscribe(channel, adapter): void

Defined in: memory-adapter.ts:14

Parameters

channel

string

adapter

MemoryAdapter

Returns

void


unsubscribe()

unsubscribe(channel, adapter): void

Defined in: memory-adapter.ts:23

Parameters

channel

string

adapter

MemoryAdapter

Returns

void

Released under the MIT License.