-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Closed
Description
Hi!
I'm trying to run this code in Deno but the result is: Uncaught (in promise) PermissionDenied: An attempt was made to access a socket in a way forbidden by its access permissions. (os error 10013)
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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels