app.get( 'pubsub', upgradeWebSocket((c) => { return { onOpen(evt, ws) { const raw = ws.raw as ServerWebSocket; raw.subscribe('pubsub'); }, onMessage(evt, ws) { const raw = ws.raw as ServerWebSocket; console.log(raw.isSubscribed('pubsub')); server.publish('pubsub', `Subscriber ${evt.data}`); } }; }) );const server = serve({ port: process.env.PORT || 3000, hostname: '0.0.0.0', fetch: hono.fetch, websocket});console.log(`Listening on ${server.hostname}:${server.port} π₯`);
statisticsRouter .basePath('/:experimentId') .use(canExperiment) .get('/statistics', significanceMiddleware, significanceHandler) .get('/chart-data', chartDataMiddleware, chartDataHandler) .get('/currencies', currenciesHandler);
composite: true