JSPM

  • Created
  • Published
  • Downloads 222
  • Score
    100M100P100Q85771F
  • License Apache-2.0

TSRPC Client for browser

Package Exports

  • tsrpc-browser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tsrpc-browser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

TSRPC Browser

TSRPC Client for browser

TSRPC is a full-stack rpc framework in TypeScript, see it at https://github.com/k8w/tsrpc

Features

  1. Full stack in TypeScript
  2. Strong type check
  3. No URL conern
  4. Support both text and binary transport
  5. Suppport customized transport encryption

Browser Support

  1. Support IE8+, Chrome, Firefox
  2. BinaryTransport only support IE10+/Chrome/Firefox

Usage

npm install tsrpc-browser
import { TsrpcClient } from 'tsrpc-browser';
import PtlHelloWorld from './protocol/PtlHelloWorld';

let client = new TsrpcClient({ serverUrl: 'http://localhost:3000' })

// The same with TSRPC NodeJS Client
client.callApi(PtlHelloWorld, { name: 'k8w' }).then(res => {
    console.log(res.reply); //Hello, k8w!
})