Skip to content

Commit b36e099

Browse files
committed
Update readme
1 parent 3156e23 commit b36e099

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# @rubriclab/events
2-
The Actions package aims to provide a powerful and simple way to define actions (which are essentially API primitives) and execute them safely with JSON serializable payloads.
2+
3+
The Events package aims to provide a powerful and simple way to define events which can be emitted from the server and consumed on the client.
34

45
It is part of Rubric's architecture for Generative UI when used with:
56
- [@rubriclab/actions](https://github.com/rubriclab/actions)
67
- [@rubriclab/blocks](https://github.com/rubriclab/blocks)
78
- [@rubriclab/chains](https://github.com/rubriclab/chains)
89
- [@rubriclab/agents](https://github.com/rubriclab/agents)
9-
- [@rubriclab/events](https://github.com/rubriclab/events)
1010

1111
[Demo](https://chat.rubric.sh)
1212

lib/server/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export function createEventsServer<EventTypes extends GenericEvents>({
1313
type EventTypeKeys = keyof typeof eventTypes
1414

1515
const subscriber = new Redis(redisURL)
16+
1617
const publisher = new Redis(redisURL)
1718

1819
async function publish<EventTypeKey extends EventTypeKeys>({
@@ -29,11 +30,13 @@ export function createEventsServer<EventTypes extends GenericEvents>({
2930

3031
async function GET(req: Request): Promise<Response> {
3132
const { searchParams } = new URL(req.url)
33+
3234
const id = searchParams.get('id')
3335

3436
if (!id) return new Response('No ID provided', { status: 400 })
3537

3638
const { writable, readable } = new TransformStream()
39+
3740
const writer = writable.getWriter()
3841

3942
const encoder = new TextEncoder()
@@ -44,6 +47,7 @@ export function createEventsServer<EventTypes extends GenericEvents>({
4447
}
4548

4649
subscriber.subscribe(id)
50+
4751
subscriber.on('message', listener)
4852

4953
req.signal.addEventListener('abort', () => {

0 commit comments

Comments
 (0)