Socket
Socket
Sign inDemoInstall

@solana/subscribable

Package Overview
Dependencies
Maintainers
0
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/subscribable - npm Package Compare versions

Comparing version 2.0.0-canary-20241004212313 to 2.0.0-canary-20241004212851

dist/types/demultiplex.d.ts

1

dist/types/index.d.ts
export * from './async-iterable';
export * from './data-publisher';
export * from './demultiplex';
export * from './event-emitter';
//# sourceMappingURL=index.d.ts.map

4

package.json
{
"name": "@solana/subscribable",
"version": "2.0.0-canary-20241004212313",
"version": "2.0.0-canary-20241004212851",
"description": "Helpers for creating subscription-based event emitters",

@@ -60,3 +60,3 @@ "exports": {

"dependencies": {
"@solana/errors": "2.0.0-canary-20241004212313"
"@solana/errors": "2.0.0-canary-20241004212851"
},

@@ -63,0 +63,0 @@ "peerDependencies": {

@@ -87,2 +87,27 @@ [![npm][npm-image]][npm-url]

### `demultiplexDataPublisher(publisher, sourceChannelName, messageTransformer)`
Given a channel that carries messages for multiple subscribers on a single channel name, this function returns a new `DataPublisher` that splits them into multiple channel names.
Imagine a channel that carries multiple notifications whose destination is contained within the message itself.
```ts
const demuxedDataPublisher = demultiplexDataPublisher(channel, 'message', message => {
const destinationChannelName = `notification-for:${message.subscriberId}`;
return [destinationChannelName, message];
});
```
Now you can subscribe to _only_ the messages you are interested in, without having to subscribe to the entire `'message'` channel and filter out the messages that are not for you.
```ts
demuxedDataPublisher.on(
'notification-for:123',
message => {
console.log('Got a message for subscriber 123', message);
},
{ signal: AbortSignal.timeout(5_000) },
);
```
### `getDataPublisherFromEventEmitter(emitter)`

@@ -89,0 +114,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc