erebos

erebos

  • Docs
  • Examples
  • API
  • Help
  • GitHub

›RPC tools

Docs

  • Introduction
  • Getting started

Swarm examples

  • File storage examples
  • Feeds examples
  • Communications examples

Swarm APIs and CLI

  • Swarm client
  • Individual APIs
  • Bzz API
  • Bzz Feed API
  • Bzz FS API
  • Pss API
  • CLI

Data structures

  • Data structures
  • Feed lists
  • Document synchronization
  • Timeline

Timeline protocol

  • Timeline specification
  • Timeline example
  • Timeline API

Utility libraries

  • Hexadecimal encoding
  • Keccak256 hashing
  • SECP256k1 signing
  • Hierarchical Deterministic wallet

RPC tools

  • RPC clients, handler and transport
  • Base RPC class and types
  • RPC Errors
  • RequestRPC client (stateless)
  • StreamRPC client (stateful)
  • RPC handler
  • RPC client over HTTP
  • RPC client over WebSocket
  • RPC client over IPC
  • RPC client for browsers
  • RPC client for Node
  • RPC client for Electron
  • HTTP transport
  • WebSocket transport
  • IPC transport
  • Electron transport
Edit

StreamRPC client (stateful)

Purpose

Class extending BaseRPC to handle stateless JSON-RPC 2.0 calls.

See the IPC transport and WebSocket transports documentation for possible transports and the RequestRPC class documentation to handle stateless JSON-RPC 2.0 calls.

Installation

npm install @erebos/rpc-stream

Usage

import { StreamRPC } from '@erebos/rpc-stream'
import { createTransport } from '@erebos/transport-ipc'

class MyAPI extends StreamRPC {
  constructor(path: string) {
    super(createTransport(path))
  }

  getUser(id: string): Promise<{ name: string }> {
    return this.request('getUser', [id])
  }
}

const api = new MyAPI('/path/to/socket')
api.getUser('1234')

StreamRPC class

See the BaseRPC documentation for inherited methods and properties.

new StreamRPC()

Arguments

  1. subject: Subject: a RxJS Subject handling communication with the server.

.request()

Arguments

  1. method: string
  2. params: T = any

Returns Promise<R = any>

← RequestRPC client (stateless)RPC handler →
  • Purpose
  • Installation
  • Usage
  • StreamRPC class
    • new StreamRPC()
    • .request()
Docs
Getting StartedAPI ReferenceCLI
Community
Gitter chatGitHub repositoryStar
Swarm
Official documentationHTTP gatewayDevelopment chat