summaryrefslogtreecommitdiff
path: root/src/web.mjs
blob: b13640b6b45fa8c95f755bd616dfbf0b935ad442 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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) =>
	await hero.buildServer({
		name,
		routes,
		socket,
		pipe,
	}).start();