import * as u from "./utils.mjs"; import * as hero from "./hero.mjs"; const name = "papo"; const newConnection = (req, ws) => { // console.log({ ws, req }); // ws.on("error", console.error); // ws.on("message", x => console.log(x.toString())); // ws.send("hello from the server"); }; const routes = [ [ "WEBSOCKET", "/api/socket", newConnection ], ]; export const app = async (socket, pipe) => { const server = hero.buildServer({ name, routes, socket, pipe, }); await server.start(); hero.log.info({ type: "starting-server", name, socket, pipe, }); };