Socket
Book a DemoInstallSign in
Socket

urbit-airlock

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urbit-airlock

A library for interacting with your urbit over HTTP

latest
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

Urbit Airlock bindings

Installation

npm install urbit-airlock --save

Usage

Connection

Opening a connection to your urbit is as follows

const connection = await connect(
  'zod',
  'http://localhost',
  80,
  'lidlut-tabwed-pillex-ridrup'
);
const channel = new Channel(connection);

You may then subscribe and poke over the connection.



channel.subscribe('chat-view', '/primary', {
  mark: 'json',
  onError: (err: any) => { console.log(err); },
  onEvent: (event: any) => { console.log(event); },
  onQuit: (err: any) => { console.log(err); }
});

channel.poke('gall-app', {
  mark: 'json',
  data: { update: 2 }
});

Typescript

Pokes and subscription updates are strongly typed, but you need to make the interface-mark correspondence known to typescript.

You associate a mark to an interface like so

declare module 'urbit-airlock/lib/marks' {
  interface Marks {
    readonly 'number': number;
  }
}

This associates the 'number' mark to the typescript type number

FAQs

Package last updated on 31 Mar 2020

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