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 🙏

© 2024 – Pkg Stats / Ryan Hefner

dircc

v0.0.0

Published

Detachable, persistent IRC connection.

Downloads

1

Readme

dircc

Build Status Code Coverage

Detachable, persistent IRC connection.

The actual connection to the server runs in a detached process, making it possible to reload your IRC client without breaking the connection to the server.

It uses an ircc Connection internally, which only handles the connection, not the communication. It doesn't respond to PINGs, doesn't send NICK and USER at the start of the session, et cetera.

Example

var dircc = require('dircc');

dircc.createConnection('ircc.sock', function(client) {
  client.on('init', function() {
    // called if there is no connection yet, so create one:
    client.connect(6667, 'irc.example.com');
    client.on('connect', function() {
      // registration:
      client.send('NICK', 'MyBoy');
      client.send('USER', 'mybot', 0, 0, 'My Awesome Bot');
    });
  });
  client.on('message', function(message) {
    console.log(message);
    if (message.command === 'WELCOME') {
      client.send('JOIN', '#channel');
    }
  });
});

Installation

$ npm install dircc

Dependencies

API

dircc(filename, function(client) {})

dircc.createConnection(filename, function(client) {})

Creates a new ConnectionClient and connects it to the ConnectionServer via the unix socket at filename. If there is no server yet, it will be spawned.

The callback is optional and will be called when the ConnectionClient is ready.

Returns an eventemitter:

var connectionEmitter = dircc('irc.sock');
connectionEmitter.on('client', function(client) {
  /* ... */
});

connectionEmitter.on('client', function(client) {})

Emitted when the ConnectionClient is ready.

connectionEmitter.on('error', function(error) {})

Emitted when there's a problem with the ConnectionServer.

dircc.ConnectionClient

Connects to the ConnectionServer via the unix socket at filename:

var client = new ircc.ConnectionClient(filename);

client.connect(...)

Calls the server's .connect(...) method.

client.close()

Calls the server's .close() method.

client.send(...)

Calls the server's .send(...) method.

client.on('message', function(message) {})

Emitted when the ConnectionServer receives a message from the IRC server. The message is the same as you would expect from an ircc Connection or from the ircp parser.

client.on('connect', function() {})

Emitted when the ConnectionServer has a working Connection to the IRC server.

Important: this event is also emitted when connecting to an existing server with an existing Connection. Therefore it does not imply a "freshly made" connection.

client.on('init', function() {})

Emitted when connected to a ConnectionServer that doesn't have a Connection to an IRC server yet. This is, in essence, a prompt to call client.connect(...):

dircc.ConnectionServer

Manages a Connection and offers an API to communicate with it via a unix socket (using dnode).

var server = new ircc.ConnectionServer();

server.listen(filename)

Start listening to the unix socket at filename. If it already exists and can be connected to, the server will emit 'superfluous' and stop.

server.connect(port, host)

Create and open Connection to IRC server at host:port.

server.close()

Close the Connection.

server.send(messageObject)

server.send(command, [parameters...])

Send an IRC message. See Connection.

server.on('listening', function() {})

Emitted after the ConnectionServer starts listening for clients on the unix socket.

server.on('connect', function() {})

Emitted after the Connection to the IRC server is created and open.

server.on('superfluous', function() {})

Emitted if there's already a server running on the given unix socket.

server.on('error', function(error) {})

Emitted when there's a problem with the unix socket server.

server.on('close', function() {})

Emitted after the unix socket has been closed.

License

BSD 2-clause. See LICENSE.