Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
ts-simple-event-bus
Advanced tools
A simple event bus that implements a pub / sub pattern. Fully typed.
Simple publish and subscribe:
import { EventBus, Callback } from "ts-simple-event-bus";
import { uuid } from "uuid";
type MessagePayload = {
a: string;
b: number;
};
// Use a function to generate a unique id.
const bus = new EventBus(uuid);
//
const callback: Callback<MessagePayload> = (message) => {
console.log(message.id, message.a, message.b);
};
bus.subscribe<MessagePayload>({ queue: "queue", callback });
bus.publish<MessagePayload>("queue", { a: "a", b: 1 });
Waiting for a response:
const bus = new EventBus(idGenerator);
const responseQueueName = "event-response";
bus.subscribe({
queue: "event-request",
callback: (msg, id) => {
bus.publish({ queue: responseQueueName, message: { event: "response" }, id });
},
});
const result = await bus.publishAndWaitForResponse({
queue: "event-request",
responseQueue: responseQueueName,
message: { event: "request" },
timeout: 1000,
});
// result will be { event: "response" }
FAQs
Simple TS event bus
The npm package ts-simple-event-bus receives a total of 42 weekly downloads. As such, ts-simple-event-bus popularity was classified as not popular.
We found that ts-simple-event-bus demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.