Skip to main content
Module

x/alosaur/examples/sse/chat.handler.ts

Alosaur - Deno web framework with many decorators
Very Popular
Go to Latest
File
const clients = new Map<number, Function>();let clientId = 0;function dispatch(msg: string): void { for (const client of clients.values()) { client(msg); }}
export async function ChatHandler(send: Function): Promise<void> { const id = ++clientId; clients.set(id, send); dispatch(`Connected: [${id}]`);}