1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
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,
});
};
|