
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@morgan-stanley/composeui-messaging-client
Advanced tools
JavaScript client for ComposeUI's Message Router
This package provides a JavaScript/TypeScript client for connecting to the ComposeUI MessageRouter from web modules. It enables publish/subscribe messaging and service invocation between web applications and the ComposeUI messaging infrastructure.
Install the package:
npm install @morgan-stanley/composeui-messaging-client
Import and create a client:
import { createMessageRouter } from "@morgan-stanley/composeui-messaging-client";
let client = createMessageRouter();
await client.connect();
client.subscribe('exampleTopic', (message) => {
const payload = JSON.parse(message.payload);
console.log(payload);
});
await client.publish('exampleTopic', JSON.stringify({ foo: "bar" }));
await client.registerService('myService', async (endpoint, payload, context) => {
// handle the request and return a response string
return "response";
});
const response = await client.invoke('myService', "request payload");
console.log(response); // response string from the service
const subscription = client.subscribe('exampleTopic', handler);
// Later, to unsubscribe:
subscription.unsubscribe();
createMessageRouter(options?)
Creates a new MessageRouter client instance.
options
(optional): Configuration object for the client.client.connect() => Promise<void>
Establishes a connection to the MessageRouter.
Promise<void>
client.close() => Promise<void>
Closes the connection to the MessageRouter.
Promise<void>
client.subscribe(topic: string, subscriber: TopicSubscriber) => Promise<Unsubscribable>
Subscribes to a topic and registers a handler for incoming messages.
topic
: The topic string to subscribe to.handler
: Function called with each message received: PartialObserver<TopicMessage> | ((message: TopicMessage) => void)
.Unsubscribable
(call unsubscribe()
to remove the handler)client.publish(topic: string, payload: MessageBuffer, options?: PublishOptions) => Promise<void>
Publishes a message to a topic.
topic
: The topic string to publish to.payload
: The message payload as a string.options
: Additional publish options (correlationId
).Promise<void>
client.invoke(service: string, payload: MessageBuffer, options?: InvokeOptions) => Promise<MessageBuffer | undefined>
Invokes a service and returns the response.
service
: The service name to invoke.payload
: The request payload as a string.options
: Additional invoke options (correlationId
).Promise<string | undefined>
(the response payload)client.registerService(service: string, handler: MessageHandler, descriptor?: EndpointDescriptor | undefined) => Promise<void>)
Registers a service handler for a given service name.
service
: The service name to register.handler
: Async function that receives the endpoint, request payload, and context, and returns a response payload. (endpoint: string, payload: MessageBuffer | undefined, context: MessageContext) => (MessageBuffer | Promise<MessageBuffer> | void | Promise<void>)
descriptor
: Additional description for the endpointPromise<void>
client.unregisterService(service: string) => Promise<void>
Unregisters a previously registered service.
service
: The service name to unregister.Promise<void>
client.registerEndpoint(endpoint: string, handler: MessageHandler, descriptor?: EndpointDescriptor | undefined) => Promise<void>
Registers a local endpoint handler that is not advertised to other clients.
endpoint
: The endpoint name to register.handler
: Async function that receives the endpoint, request payload, and context, and returns a response payload. (endpoint: string, payload: MessageBuffer | undefined, context: MessageContext) => (MessageBuffer | Promise<MessageBuffer> | void | Promise<void>)
.descriptor
(optional): Endpoint descriptor object containing additional description for the endpoint.Promise<void>
client.unregisterEndpoint(endpoint: string) => Promise<void>
Unregisters a previously registered local endpoint.
endpoint
: The endpoint name to unregister.Promise<void>
client.state()
Returns the current connection state of the client.
ClientState
(Created
, Connecting
, Connected
, Closing
, Closed
)if (client.state === ClientState.Connected) {
// Client is connected
}
© Morgan Stanley. See NOTICE file for additional information.
FAQs
JavaScript client for ComposeUI's Message Router
The npm package @morgan-stanley/composeui-messaging-client receives a total of 23 weekly downloads. As such, @morgan-stanley/composeui-messaging-client popularity was classified as not popular.
We found that @morgan-stanley/composeui-messaging-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.