Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
A blazing fast, slim communication protocol for NodeJS IPC.
shared.ts
enum AuthTopics {
login, // can be strings or numbers
}
interface AuthApi {
[AuthTopics.login]: {
req: Credentials;
res: User;
};
}
server.ts
import { createServer } from "beamed";
import { AuthApi, AuthTopics } from "./shared";
const bs = createServer<AuthApi>()
.onRequest(AuthTopics.login, authenticate)
.listen("/tmp/auth-test");
client.ts
import { connect } from "beamed";
import { AuthApi, AuthTopics } from "./shared";
const bc = connect<AuthApi>("/tmp/auth-test");
bc.request(AuthTopics.login, new Credentials("user", "p4ssw0rd")).then((user) =>
console.log(user)
);
Message types (Not completely implementing yet).
Type | Message-Pattern | Examples |
---|---|---|
Request | <length>?<topic>|<id>[|payload] | 19?1|8|J{"foo":"bar"} 5?2|45 |
Response | <length>.<id>[|payload] | 17.8|J{"foo":"bar"} 3.45 |
Error-Response | <length>X<id>|<error-code>[|message] | 17.8|J{"foo":"bar"} 6X45|42 |
Subscribe | <length>+<topic> | 2+1 |
Unsubscribe | <length>-<topic> | 2-1 |
Message / Push | <length>!<topic>[|payload] | 17!1|J{"foo":"bar"} 2!2 |
Where the tokens have the following format
Token | Format | Note |
---|---|---|
length | numeric | The byte length of the message content without this length (auto-generated) |
topic | utf-8 (except | ) | You can use TS Enums |
id | numeric | The request id (auto-generated) |
error-code | utf-8 (except | ) | You can use TS Enums |
message | utf-8 | Custom Error decription |
payload | utf-8 or Buffer | Prefixed by a character that determines the content type:J for Json,B for binary data,T for text |
FAQs
A blazing fast, slim communication protocol for NodeJS IPC
The npm package beamed receives a total of 5 weekly downloads. As such, beamed popularity was classified as not popular.
We found that beamed demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.