Neoroute TypeScript Client SDK

Official SDK for TypeScript - GitHub - NPM registry

If you want to connect to your Neoroute server from NodeJS or the browser, you can follow this guide on how to install the official SDK. Actual functionality and usage is explained in the relevant pages under the Client category of the documentation.

We, ourselves, only test this SDK with TypeScript since that’s what we use. However, you should also be able to get it to work in JavaScript.

Installation

You literally just install the package.

npm install @liphium/neoroute-ts

For how to actually connect, follow the WebSocket or HTTP page.

Features

  • Written in modern TypeScript using only Browser APIs and MessagePack for JavaScript
  • Supports WebSocket and HTTP transporters (everything available in Neoroute as of writing this)
  • Basically equivalent to the official Go client SDK
  • Code generation support via neogen
  • Central error handling without try-catch (This SDK was written by Go developers, what did you expect?)

Notes

  • When sending requests, you do not need to surround them with a try-catch. All errors are first passed to the central error handler in the Config object you give to a Client. The string you return there is packaged into a UserError, the object returned by almost all send functions.

Examples

We have some examples available in the GitHub repository. They’re mostly ported over from the Go side of things, meaning you need to run the server from the Go examples to actually be able to test them out.

Guides for how to run them are available in the README of all the examples.

Runtime support

We verified that the browser and NodeJS both work without problems in our tests. The only dependency we have is MessagePack, the encoding we use instead of JSON.

Other than that, we use the native Browser APIs like fetch and WebSocket. For this reason, there should not be any issues. If you still find an environment that has problems or there is something wrong with our SDK, please kindly let us know on GitHub.