Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Latest commit

 

History

History
32 lines (19 loc) · 670 Bytes

README.md

File metadata and controls

32 lines (19 loc) · 670 Bytes

rpc-browser

rpc-request or rpc-stream factory with automatic transport selection.

Installation

yarn add @mainframe/rpc-browser

Usage

import browserRPC from '@mainframe/rpc-browser'

const rpcOverHTTP = browserRPC('http://localhost') // RequestRPC using HTTP transport
const rpcOverWS = browserRPC('ws://localhost') // StreamRPC using WebSocket transport

API

browserRPC()

Arguments

  1. endpoint: string: HTTP or WebSocket URL to connect to.

Returns RequestRPC (with HTTP endpoint) or StreamRPC (with WebSocket endpoint).

License

MIT