Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
If you need to send a payload with out the possibility of a response, then you can send a unidirectional payload, otherwise knon as an assertion. Both the client and server can send an assertion to each other, once the assertion is sent, it cannot be rep
Trixi is a WebSocket wrapper that enables developers to create better and stricter acpplications. The way we do this is that we use scoped socket interactions which allows you to have a scope for unidirectional payloads, operator based payloads, and bidirectional payloads. All of this is done through the use of a standardized payload schema.
If you need to send a payload with out the possibility of a response, then you can send a unidirectional payload, otherwise knon as an assertion. Both the client and server can send an assertion to each other, once the assertion is sent, it cannot be replied to in any way.
import trixi from 'trixi';
import { Server } from 'http';
const httpServer = new Server();
const app = trixi();
/**
* Server Example
*/
httpServer.listen(8080, () => {
const server = app.createServer({ httpServer });
server.onConnection(connection => {
console.log("A new socket connection has been established from", connection.remoteAddress);
// Send your assertion message on start
connection.assert("Welcome...");
// Create a listener for assertions from the client
connection.onAssert(assertion => {
console.log("New assertion from client:", assertion.data);
});
});
});
/**
* Client Example
*/
const client = app.createClient({ url: "ws://localhost:8080" });
client.assert("I have arrived!!");
client.onAssert(assertion => {
console.log("New assertion from server:", assertion.data);
});
Sometimes you want to be able to hear back from your client when you send a message, so with bidirectional payloads, you'll be able to send a payload, and recieve payload in response if you so choose. When you response, it will be sent directionally to the original payload which you can start a listener for a response on.
import trixi from 'trixi';
import { Server } from 'http';
const httpServer = new Server();
const app = trixi();
/**
* Server Example
*/
httpServer.listen(8080, () => {
const server = app.createServer({ httpServer });
server.onConnection(connection => {
console.log("A new socket connection has been established from", connection.remoteAddress);
// Create your listener
connection.onPayload(msg => {
console.log("Recieved a payload from the client", msg.data);
msg.reply({ recieved: true });
})
});
});
/**
* Client Example
*/
const client = app.createClient({ url: "ws://localhost:8080" });
// Send a message to the server and await a response
client.send({ hello: "world" }).then(payload => {
payload.onResponse(response => {
console.log("Recieved response from the server", response.data);
})
});
Operator payloads are something that you can use to send a payload with a specific operator code attached to it. Once you send the operator payload, the client can listen for it and if it choose to, it can reply in the same manor as the bidrectional payload.
import trixi from 'trixi';
import { Server } from 'http';
const httpServer = new Server();
const app = trixi();
/**
* Server Example
*/
httpServer.listen(8080, () => {
const server = app.createServer({ httpServer });
server.onConnection(connection => {
console.log("A new socket connection has been established from", connection.remoteAddress);
// When a new connection is established, send the "hello:world" operator.
connection.sendOp("hello:world", { greeting: "Hello World" });
});
});
/**
* Client Example
*/
const client = app.createClient({ url: "ws://localhost:8080" });
// Create a listener on the operator "hello:world"
client.onOp("hello:world", e => {
console.log("New message on 'hello:world':", e.data);
});
NOTE: You can send a string or a json object as a payload.
FAQs
If you need to send a payload with out the possibility of a response, then you can send a unidirectional payload, otherwise knon as an assertion. Both the client and server can send an assertion to each other, once the assertion is sent, it cannot be rep
We found that trixi 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.