Registry / messaging / lime-transport-websocket

lime-transport-websocket

JSON →
library2.0.3jsnpmunverified

WebSocket transport implementation for the LIME (Lightweight Messaging Protocol) protocol. Version 2.0.3 enables bidirectional communication over WebSockets for LIME-based applications, commonly used in instant messaging and IoT. The library provides a WebSocketTransport class that implements the LIME transport contract, supporting connection management, message serialization, and automatic reconnection. It is part of the LIME protocol ecosystem, typically used alongside lime-client and lime-csharp. Released under MIT license.

npm install lime-transport-websocket
INSTALL
IMPORT
SIG · LIME-TRANSPORT-WEB
L
lime-transport-websocket
messagingjavascriptv2.0.3
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.

WebSocketTransport
import { WebSocketTransport } from 'lime-transport-websocket'
const WebSocketTransport = require('lime-transport-websocket')
ESM-only since v2; CJS require may fail.
WebSocketTransport
import WebSocketTransport from 'lime-transport-websocket'
import WebSocketTransport from 'lime-transport-websocket/src/transport'
Default export available since v1.
WebSocketTransportOptions
import type { WebSocketTransportOptions } from 'lime-transport-websocket'
Type-only import for TypeScript users.

Shows creating a WebSocketTransport, connecting, sending a LIME message, and handling events.

import { WebSocketTransport } from 'lime-transport-websocket'; const transport = new WebSocketTransport({ url: 'wss://example.com/lime', pingInterval: 30000 }); transport.on('connected', () => { console.log('Connected'); transport.send({ id: '1', from: 'client@domain', to: 'server@domain', type: 'text/plain', content: 'Hello' }); }); transport.on('message', (message) => { console.log('Received:', message); }); transport.connect().catch(console.error);
Debug
Known issues
breakingIn v2.0.0, default export changed from WebSocketTransport to named export. Requires destructured import.
fix
Use `import { WebSocketTransport } from 'lime-transport-websocket'` instead of default import.
affects: >=2.0.0 <3.0.0
deprecatedThe 'ws' package is no longer bundled; you must install it separately in Node.js environments.
fix
Run `npm install ws` if using Node.js.
affects: >=2.0.0
gotchaIn environments without native WebSocket (Node.js < 18), you must provide a WebSocket implementation via options.wsConstructor.
fix
Pass `wsConstructor: require('ws')` in options.
affects: >=1.0.0
breakingThe transport no longer automatically reconnects; you must implement reconnection logic.
fix
Listen for 'disconnected' event and call connect() again.
affects: >=2.0.0
gotchaMessages must conform to LIME envelope format; otherwise the transport may reject them silently.
fix
Ensure messages have 'id', 'from', 'to', 'type', and 'content' fields.
affects: >=1.0.0
deprecatedSupport for CommonJS (require) is deprecated in v2. Use ESM imports only.
fix
Switch to `import` syntax or use dynamic import.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: WebSocketTransport is not a constructor
Using default import in v2 which requires named import.
fix
Change to `import { WebSocketTransport } from 'lime-transport-websocket'`.
Error: Module not found: 'ws'
Missing 'ws' package for Node.js WebSocket implementation.
fix
Run `npm install ws` in your project.
Error: Not supported (please set WebSocket constructor)
No global WebSocket (e.g., Node.js <18) and ws constructor not provided.
fix
Pass `wsConstructor: require('ws')` in options or upgrade Node.js.
TypeError: message.id is undefined
Sending malformed LIME envelope without required fields.
fix
Ensure message object includes 'id', 'from', 'to', 'type', and 'content'.
Upgrade
Version history
2.0.3latest on npm
Audit
Dependencies
wsoptionalWebSocket client for Node.js environments
lime-transportrequiredBase transport interface and types
Agent activity
10 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
lime-transport-websocket — npm install lime-transport-websocket · libregistry