mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-04-26 00:46:23 +02:00
add describe for /stream
This commit is contained in:
parent
9ad6331fbc
commit
1822deadc1
1 changed files with 4 additions and 13 deletions
|
|
@ -573,6 +573,10 @@ const routes = new Hono()
|
|||
)
|
||||
.get(
|
||||
'/stream',
|
||||
describeRoute({
|
||||
summary: 'Subscribe to run events',
|
||||
description: 'Subscribe to run events',
|
||||
}),
|
||||
async (c) => {
|
||||
return streamSSE(c, async (stream) => {
|
||||
const bus = container.resolve<IBus>('bus');
|
||||
|
|
@ -607,19 +611,6 @@ const routes = new Hono()
|
|||
});
|
||||
}
|
||||
)
|
||||
.get('/sse', async (c) => {
|
||||
return streamSSE(c, async (stream) => {
|
||||
while (true) {
|
||||
const message = `It is ${new Date().toISOString()}`
|
||||
await stream.writeSSE({
|
||||
data: message,
|
||||
event: 'time-update',
|
||||
id: String(id++),
|
||||
})
|
||||
await stream.sleep(1000)
|
||||
}
|
||||
})
|
||||
})
|
||||
;
|
||||
|
||||
const app = new Hono()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue