zlient 3.2.1 → 3.3.0
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.
- package/README.md +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -255,11 +255,15 @@ socket.send({ text: 'Hello!' });
|
|
|
255
255
|
```typescript
|
|
256
256
|
const stream = client.createSSE({
|
|
257
257
|
path: '/events',
|
|
258
|
-
response:
|
|
258
|
+
response: {
|
|
259
|
+
message: z.object({ type: z.literal('connected') }),
|
|
260
|
+
time: z.string(),
|
|
261
|
+
},
|
|
259
262
|
});
|
|
260
263
|
|
|
261
264
|
const sse = stream();
|
|
262
|
-
sse.on('message', (data) => console.log(data.
|
|
265
|
+
sse.on('message', (data) => console.log(data.type)); // Typed as { type: 'connected' }
|
|
266
|
+
sse.on('time', (data) => console.log(data)); // Typed as string
|
|
263
267
|
```
|
|
264
268
|
|
|
265
269
|
---
|