-
|
Hi! import { serve } from "https://deno.land/std@0.150.0/http/server.ts";
import { Server } from "https://deno.land/x/socket_io@0.1.1/mod.ts";
const io = new Server();
io.on("connection", (socket) => {
console.log(`socket ${socket.id} connected`);
socket.emit("hello", "world");
socket.on("disconnect", (reason) => {
console.log(`socket ${socket.id} disconnected due to ${reason}`);
});
});
await serve(io.handler(), {
port: 3000,
});And before that code I tried to run import { serve } from "https://deno.land/std@0.50.0/http/server.ts";
const server = serve({ port: 8008 });
console.log("http://localhost:8008/");
for await (const req of server) {
if (req.url === '/') {
req.respond({
status: 200,
body: await Deno.open('./public/index.html')
});
}
}and it shows the same error. Is there any way to fix this or to run deno properly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
This is not an issue with Deno, or how you are running |
Beta Was this translation helpful? Give feedback.
This is not an issue with Deno, or how you are running
deno. The error originates from the underlying operating system indicating that environment/users thatdenois running under does not have permissions to open a socket to listen for HTTP connections.