Skip to content

error 10013 #16175

@bogdankol

Description

@bogdankol

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions