Change listener.ts

This commit is contained in:
Scott Richmond 2023-12-26 17:54:34 -05:00
parent 25f50b1100
commit 8cd4f0b47b

View File

@ -1,5 +1,6 @@
import { run } from "@ludus/ludus-js-pure" import { run } from "@ludus/ludus-js-pure"
async function listen() {
const port = Math.floor((Math.random() * 1000) + 50000) const port = Math.floor((Math.random() * 1000) + 50000)
const repl_info = { port } const repl_info = { port }
@ -15,6 +16,7 @@ Bun.listen({
port, port,
socket: { socket: {
data: (socket, data) => { data: (socket, data) => {
console.log("I got data!")
const source = data.toString("utf-8") const source = data.toString("utf-8")
const result = run(source) const result = run(source)
const msgs = result.console const msgs = result.console
@ -30,6 +32,9 @@ Bun.listen({
error: (socket, error) => { console.log(error); socket.end() } error: (socket, error) => { console.log(error); socket.end() }
} }
}) })
}
await listen()