Class: SimpleTransportDriver
Simple in-memory subscription tracking
Tracks subscriptions by internal Map object, which is suboptimal, but good enough for simple cases.
Example
export class TestTransportDriver extends SimpleTransportDriver implements TransportDriver {
constructor() {
super();
// subscription implementation
this.emit(meta, data);
}
public async send(meta: TransportMeta, data: TransportData): Promise<void> {
// transfer implementation
}
}
Implements
Partial
<TransportDriver
>
Constructors
constructor
• new SimpleTransportDriver()
Methods
emit
▸ emit(meta
, data
): Promise
<void
>
Parameters
Name | Type |
---|---|
meta |
TransportMeta |
data |
unknown |
Returns
Promise
<void
>
off
▸ off(id
, data?
): void
Parameters
Name | Type |
---|---|
id |
string |
data? |
unknown |
Returns
void
Implementation of
Partial.off
on
▸ on(filter
, callback
): string
Parameters
Name | Type |
---|---|
filter |
Partial <TransportMeta > |
callback |
TransportCallback |
Returns
string
Implementation of
Partial.on