@fatagnus/dink-sdk 2.9.0 → 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +28 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -153,6 +153,34 @@ const edge = new EdgeClient({
153
153
  });
154
154
  ```
155
155
 
156
+ ## Handling Kick Commands
157
+
158
+ Edges can be forcibly disconnected by the server (e.g., for key revocation, maintenance, or security). Register a callback to handle kick events:
159
+
160
+ ```typescript
161
+ import { EdgeClient } from '@fatagnus/dink-sdk';
162
+
163
+ const edge = new EdgeClient({ apiKey: process.env.DINK_API_KEY! });
164
+ await edge.connect();
165
+
166
+ // Register kick handler (optional but recommended)
167
+ const unsubscribe = edge.onKick((reason: string) => {
168
+ console.log(`Received kick command: ${reason}`);
169
+ // Clean up resources, save state, etc.
170
+ // The edge will automatically disconnect after this callback
171
+ });
172
+
173
+ // Later, if you want to stop listening:
174
+ unsubscribe();
175
+ ```
176
+
177
+ When kicked, the edge client will:
178
+ 1. Call your `onKick` callback (if registered)
179
+ 2. Gracefully disconnect from the server
180
+ 3. Clean up all service subscriptions
181
+
182
+ **Note:** To kick an edge from your Convex backend, use `kickEdge` from `@fatagnus/dink-convex`.
183
+
156
184
  ## Subpath Exports
157
185
 
158
186
  You can also import specific clients directly:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fatagnus/dink-sdk",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "TypeScript SDK for Dink edge mesh platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",