New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

zubox

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zubox

A powerful solution to website servers.

latest
npmnpm
Version
1.0.8
Version published
Maintainers
1
Created
Source

Zubox

Zubox is a Node.js package for creating and managing TCP clients and servers.

Installation

You can install Zubox via npm:

npm install zubox

Usage

import { Client, Host } from 'zubox';

// Create a server instance
const myServer = new Host(4051);

// Create a client instance
const myClient = new Client({ host: 'localhost', port: 4051 });

// Listen for incoming data on the server
myServer.listen((data) => {
    if (data().author !== "host") {
        return;
    }
    console.log(data());
    return data().data[data().data.length - 1];
});

// Connect the client to the server
myClient.connect({ author: "host" });

// Synchronize data with the server
myClient.sync('pull');
myClient.sync('robot').then((dataa) => {
    console.log("Promise resolved, " + dataa);
});

API

Host

Constructor

  • new Host(port: number): Creates a new server instance listening on the specified port.

Methods

  • listen(callback: Function): Starts listening for incoming connections. The callback function is invoked when data is received.

Client

Constructor

  • new Client(options: { host: string, port: number }): Creates a new client instance with the specified host and port.

Methods

  • connect(data: any): Connects the client to the server with optional data.
  • sync(action: string): Synchronizes data with the server for the specified action.

More coming soon!

FAQs

Package last updated on 13 Mar 2024

Did you know?

Socket

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.

Install

Related posts