so i setup'd a basic application using workers,
channel
import { createChannel } from "better-sse";
const channel = createChannel();
export { channel as orderChannel };
/register to channel
import { createResponse } from "better-sse";
import { Hono } from "hono";
import { orderChannel } from "../channels/orderChannel";
const app = new Hono();
app.get("/register", (c) =>
createResponse(c.req.raw, (session) => {
orderChannel.register(session);
}),
);
export default app;
/broadcast to channel
import { Hono } from "hono";
import { orderChannel } from "../channels/orderChannel";
const app = new Hono<{ Bindings: Env }>();
app.post(
"/broadcast",
async (c) => {
orderChannel.broadcast("hi");
return c.json([]);
},
);
export default app;
upon subscribing to /register and sending events doesn't work, is it because of the serverless nature?
so i setup'd a basic application using workers,
channel
/register to channel
/broadcast to channel
upon subscribing to /register and sending events doesn't work, is it because of the serverless nature?