A JavaScript/TypeScript client for interacting with Iotics API.
iotics-grpc-client-ts | iotics-host |
---|---|
yarn add @iotics/grpc-client@^6 |
>= 5 |
yarn add @iotics/grpc-client@^5 |
>= 5 |
yarn add @iotics/grpc-client@^4 |
>= 5 |
yarn add @iotics/grpc-client@^3 |
>= 5 |
yarn add @iotics/grpc-client@^2 |
>= 5 |
yarn add @iotics/grpc-client@^1 |
>= 4 |
Iotics client can be run over WebSocket in case HTTP2 is not available or bidirectional streaming is required. To use
WebSockets instead of HTTP, import the grpc
from the Iotics client and set the default transport like so:
import { grpc } from '@iotics/grpc-client';
grpc.setDefaultTransport(grpc.WebsocketTransport());
Additionally, to be able to run Iotics client using Node.js (see Examples section below), the transport could be set to:
grpc.setDefaultTransport(NodeHttpTransport());
By default, the transport is set to cross browser:
grpc.setDefaultTransport(grpc.CrossBrowserHttpTransport({ withCredentials: false }));
- ts-node - example usages within Node.js runtime environment.
- To satisfy all dependencies and generate client - in a fresh clone of this repo:
make build
- To update dependencies and regenerate files - in already existing local repo:
make clean build
- To update the Iotics API version and regenerate client
(proto files are submoduled in ./iotics-api.git/ from Iotics API repo)
use the following as guidelines:git submodule update --init _ver=vX.X.X pushd iotics-api.git git fetch --tags git checkout "tags/$_ver" popd make generate-update # After addressing the changes of the new client in `src`, please update "Unreleased" section in CHANGELOG.md git add CHANGELOG.md iotics-api.git src git commit -m "Update Iotics API to $_ver" git push
Should contain a summary of the changes in CHANGELOG.md under the "Unreleased" section.
Note: Currently this package is not easy to use, hence it may contain breaking changes between patches until v2 is realeased.
- Update package version in package.json for the release:
yarn version --no-git-tag-version --patch
- For release candidates:
yarn version --no-git-tag-version --preid rc --prerelease
- More about updating version: https://classic.yarnpkg.com/en/docs/cli/version
- For release candidates:
- Update CHANGELOG.md (move notes from unreleased section, ensure right tags are used, etc.) and any other files as needed.
- Commit changes and create a PR.
- Once PR is merged, tag the commit:
_ver=vX.X.X # _ver="v$(grep version package.json |cut -d'"' -f4)" git tag -a "$_ver" -m "$_ver" git push origin "$_ver"
- The Draft Release GitHub Action will pick it up and create a draft release in releases.
- Update the release's information and publish it.
- The Publish GitHub Action will create a package and will publish it to the NPM. Note that at this point, the package for the specified version can no longer be changed. To learn more about how the npm registry treats versions, see their unpublish policies.