Registry / devops / linuxcnc-grpc

linuxcnc-grpc

JSON →
library1.0.0jsnpmunverified

TypeScript/JavaScript gRPC client for remote control of LinuxCNC machine control and HAL. Version 1.0.0 provides a stable gRPC interface to LinuxCNC's Python API, enabling remote monitoring, multi-machine management, and real-time streaming. It exposes two main services: LinuxCNCService for machine control (status, jogging, MDI, file management) and HalService for read-only HAL introspection. Key differentiators: first-class TypeScript support with generated types, real-time status streaming via gRPC, and multi-language server ecosystem (Python, Go, Rust). Ships with generated TypeScript types from protocol buffers.

npm install linuxcnc-grpc
INSTALL
IMPORT
SIG · LINUXCNC-GRPC
L
linuxcnc-grpc
devopsjavascriptv1.0.0
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.

LinuxCNCServiceClient
import { LinuxCNCServiceClient } from 'linuxcnc-grpc'
const LinuxCNCServiceClient = require('linuxcnc-grpc').LinuxCNCServiceClient
Package is ESM-first; CommonJS require via .default works but named export require is error-prone.
GetStatusRequest
import { GetStatusRequest } from 'linuxcnc-grpc'
import GetStatusRequest from 'linuxcnc-grpc'
GetStatusRequest is a named export, not default.
HalServiceClient
import { HalServiceClient } from 'linuxcnc-grpc'
import { HALServiceClient } from 'linuxcnc-grpc'
Export name uses camelCase 'HalServiceClient', not all-caps 'HAL'.

Demonstrates creating an insecure gRPC client, calling getStatus, handling errors, and logging axis positions.

import * as grpc from '@grpc/grpc-js'; import { LinuxCNCServiceClient, GetStatusRequest } from 'linuxcnc-grpc'; const client = new LinuxCNCServiceClient('localhost:50051', grpc.credentials.createInsecure()); client.getStatus(new GetStatusRequest(), (err, status) => { if (err) { console.error('Error:', err.message); return; } console.log(`Position: X=${status.position?.x?.toFixed(3) ?? 'N/A'} Y=${status.position?.y?.toFixed(3) ?? 'N/A'}`); }); // After use, close the client client.close();
Debug
Known issues
gotchaInsecure gRPC connection: using createInsecure() without TLS sends credentials in plaintext. Do not use in production.
fix
Use grpc.credentials.createSsl() with proper TLS certificates in production.
affects: >=1.0.0
gotchaMust call client.close() after use to release resources; failure to do so may cause memory leaks.
fix
Call client.close() when client is no longer needed.
affects: >=1.0.0
gotchaService methods expect request objects constructed with constructors (e.g., new GetStatusRequest()), not plain objects.
fix
Always instantiate request objects using new, e.g., new GetStatusRequest().
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: client.getStatus is not a function
Client not properly instantiated or wrong import causing undefined method.
fix
Ensure you used 'new LinuxCNCServiceClient(...)' and imported the correct constructor.
Error: 14 UNAVAILABLE: failed to connect to all addresses
gRPC server is not running or not reachable at the specified address.
fix
Start the LinuxCNC gRPC server or verify the server address/port is correct.
TypeError: GetStatusRequest is not a constructor
GetStatusRequest is a named export, not a default import.
fix
Use import { GetStatusRequest } from 'linuxcnc-grpc'.
Error: Cannot find module 'linuxcnc-grpc'
Package not installed or import path incorrect.
fix
Run 'npm install linuxcnc-grpc' and verify package.json includes it.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredgRPC runtime for JavaScript/TypeScript, required to create client connections and manage channels.
Agent activity
2 hits · last 30 days
node
2
Resources
linuxcnc-grpc — npm install linuxcnc-grpc · libregistry