A TypeScript WebSocket client for Django Channels v2 APIs powered by djangochannelsrestframework. Version 1.1.0 provides a simple, promise-based interface for CRUD operations and subscriptions, with automatic reconnection (using reconnecting-websocket with backoff) and subscription restart. Key differentiators: request queuing before connection, custom subscribe actions, and full TypeScript support. Active development, monthly releases.
npm install dcrf-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates connecting to a WebSocket endpoint, performing CRUD operations, subscribing to updates with a callback, cancelling a subscription, and making custom stream requests.
If using a custom WebSocket, ensure it does not rely on removed properties. Default behavior unchanged.
Use 'connect' instead of 'createClient'.
Always pass the stream name as the first argument to CRUD methods. For custom streams, use 'client.request(streamName, payload)'.
Install 'ws' and pass it in options: connect('wss://...', { websocket: { WebSocket: require('ws') } })Update imports to ESM default import style. Consult upgrade guide in changelog.
const WebSocket = require('ws'); const client = dcrf.connect('wss://...', { websocket: { WebSocket } });Check server logs; ensure the endpoint is a valid Django Channels WebSocket. Also verify you are connecting to the correct URL.
Use named import: import { connect } from 'dcrf-client'; const client = connect('wss://...');Always provide stream name as first argument.