npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tart-transport-http

v0.1.0

Published

HTTP transport implementation for tart

Readme

tart-transport-http

Stability: 1 - Experimental

NPM version

HTTP transport implementation for Tiny Actor Run-Time in JavaScript.

Contributors

@dalnefre, @tristanls

Overview

An implementation of a HTTP transport for Tiny Actor Run-Time in JavaScript.

Usage

To run the below example run:

npm run readme
"use strict";

var http = require('http');
var tart = require('tart');
var transport = require('../index.js');

var sponsor = tart.minimal();

var send = sponsor(transport.sendBeh);

var receivedMessageCount = 0;
var receptionist = sponsor(function (message) {
    console.log('received message:', message);
    receivedMessageCount++;
    if (receivedMessageCount >= 2) {
        close(); // close listening server
    }
});

var serverCapabilities = transport.server(receptionist);
var close = sponsor(serverCapabilities.closeBeh);
var listen = sponsor(serverCapabilities.listenBeh);

var fail = sponsor(function (error) {
    console.dir(error);
});

var listenAck = sponsor(function listenAckBeh(message) {
    console.log('transport listening on http://' + message.host + ':' + message.port);
    send({
        address: 'http://localhost:7847/#t5YM5nxnJ/xkPTo3gtHEyLdwMRFIwyJOv5kvcFs+FoMGdyoDNgSLolq0',
        content: '{"some":{"json":"content"},"foo":true}',
        fail: fail,
        ok: function () {
            console.log('foo sent');
        }
    });
    send({
        address: 'http://localhost:7847/#I0InGCVn0ApX0YBnF5+JFMheKOajHkaTrNthYRI2hOj4GrM5IaWO1Cv0',
        content: '{"some":{"json":"content"},"bar":true}',
        fail: fail,
        ok: function () {
            console.log('bar sent');
        }
    });    
});

listen({
    host: 'localhost', 
    port: 7847, 
    ok: listenAck,
    fail: fail
});

Tests

npm test

Documentation

Public API

transport.sendBeh

Actor behavior that will attempt to send messages over TLS.

Message format:

  • address: String HTTP address in URI format. Scheme, host, and port are required. Framgment is optional but usually necessary. For example: http://localhost:7847/#t5YM5nxnJ/xkPTo....
  • content: String JSON content to be sent.
  • fail: Actor function (error) {} (Default: undefined) Optional actor to report error (if any).
  • ok: Actor function () {} (Default: undefined) Optional actor to report successful send to the destination.
var send = sponsor(transport.sendBeh);
send({
    address: 'tcp://localhost:7847/#ZkiLrAwGX7N1eeOXXMAeoVp7vsYJKeISjfT5fESfkRiZOIpkPx1bAS8y', 
    content: '{"some":{"json":"content"}}'
});

transport.server(receptionist)

  • receptionist: Actor function (message) {} Actor to forward traffic received by this server in {address: <URI>, contents: <json>} format.
  • Return: Object An object containing behaviors for listen and close capabilities.

Creates an entangled pair of capabilities that will control a single HTTP server.

serverCapabilities.closeBeh

Actor behavior that will close a listening server.

Message is an ack Actor function () {}, an actor that will be sent an empty message once the server closes.

var serverCapabilities = transport.server(receptionist);
var close = sponsor(serverCapabilities.closeBeh);
close(sponsor(function ack() {
    console.log('acked close'); 
});

serverCapabilities.listenBeh

Actor behavior that will create a new listening HTTP server.

Message format:

  • host: String HTTP host to listen on.
  • port: Number HTTP port to listen on.
  • ok: Actor function (message) {} Optional actor to receive acknowledgment once the server is listening.
  • fail: Actor function (error) {} Optional actor to receive any errors when starting the HTTP transport.
var serverCapabilities = transport.server(receptionist);
var listen = sponsor(serverCapabilities.listenBeh);
listen({
    host: 'localhost',
    port: 7847,
    ok: sponsor(function listenAckBeh(message) {
        console.log('transport listening on tcp://' + message.host + ':' + message.port);
    }),
    fail: sponsor(function failBeh(message) {
        console.error(message);
    })
});

Sources