Registry / messaging / nggorpc

nggorpc

JSON →
library1.1.1jsnpmunverified

Angular client library (v1.1.1) for NgGoRPC, enabling high-performance, bidirectional gRPC over WebSockets with Angular >=14 and RxJS >=7. Handles WebSocket connection management (reconnection, keep-alive), protocol framing, stream multiplexing, and integrates with ts-proto generated code. Built for Angular CLI workspace; provides manual instantiation of NgGoRpcClient for flexible lifecycle control. Monthly releases.

npm install nggorpc
INSTALL
IMPORT
SIG · NGGORPC
N
nggorpc
messagingjavascriptv1.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NgGoRpcClient
import { NgGoRpcClient } from '@nggorpc/client';
import NgGoRpcClient from '@nggorpc/client';
Named export; default import will not work.
NgGoRpcConfig
import { NgGoRpcConfig } from '@nggorpc/client';
import { NgGoRpcConfig } from '@nggorpc/config';
Config interface is exported from the same module.
ConnectionState
import { ConnectionState } from '@nggorpc/client';
const { ConnectionState } = require('@nggorpc/client');
This is a TypeScript type/const export; require() not supported in ESM projects.

Shows creating a NgGoRpcClient with config, connecting, and making a unary RPC call with ts-proto generated definitions.

import { Injectable, NgZone, inject } from '@angular/core'; import { NgGoRpcClient } from '@nggorpc/client'; @Injectable({ providedIn: 'root' }) export class GrpcService { private ngZone = inject(NgZone); public client: NgGoRpcClient; constructor() { this.client = new NgGoRpcClient(this.ngZone, { enableLogging: true, pingInterval: 15000 }); this.client.connect('ws://localhost:8080/rpc'); } } import { Component, inject } from '@angular/core'; import { MyServiceDefinition } from './generated/myservice'; @Component({ template: '' }) export class UserComponent { private grpcService = inject(GrpcService); ngOnInit() { const transport = this.grpcService.client.createTransport(); transport.request( MyServiceDefinition, MyServiceDefinition.methods.getUser, { userId: '123' } ).subscribe(response => console.log('User:', response)); } }
Debug
Known issues
gotchaNgGoRpcClient requires NgZone to be injected manually; using global singleton without NgZone causes change detection issues in Angular.
fix
Always inject NgZone and pass it to the constructor: new NgGoRpcClient(ngZone, config).
affects: >=1.0.0
gotchaThe `createTransport()` method creates a new transport instance each call; sharing a single transport for multiple requests is not recommended as it may cause stream ID conflicts.
fix
Create a transport per service or per component, not a global singleton transport.
affects: >=1.0.0
deprecatedOlder documentation refers to a global service provider pattern; manual instantiation is the current recommended approach.
fix
Use manual instantiation with `new NgGoRpcClient(ngZone, config)` instead of relying on deprecated Angular service providers.
affects: >=1.0.0
gotchaThe `setAuthToken` method sets a token that is sent as `Bearer` in the `authorization` header; if the backend expects a different scheme (e.g., `Token`), authentication will fail.
fix
Ensure the backend expects `Bearer <token>` in the `authorization` header, or modify the client source.
affects: >=1.0.0
Errors
Common errors & fixes
ERROR NullInjectorError: R3InjectorError(AppModule)[NgZone -> NgZone]
NgGoRpcClient instantiated outside Angular context (e.g., in a plain class without dependency injection).
fix
Instantiate NgGoRpcClient inside an Angular service or component using `inject(NgZone)`.
TypeError: ngZone.run is not a function
Passing an incorrect value as `ngZone` (e.g., a string or undefined).
fix
Ensure you inject `NgZone` from `@angular/core` and pass it to the constructor.
Error: Unsupported method: onUnauthenticated
The client version is too old; `onUnauthenticated` callback was removed in v1.1.0.
fix
Update to @nggorpc/client >=1.1.0 and use the `connectionState$` observable instead.
Module not found: Error: Can't resolve '@nggorpc/client'
Package not installed or not included in tsconfig paths.
fix
Run `npm install @nggorpc/client` and ensure your Angular project can resolve the package.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
@angular/corerequiredAngular framework dependency (NgZone, inject)
rxjsrequiredObservable-based streaming and connection state
Agent activity
16 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
nggorpc — npm install nggorpc · libregistry