Cannot Open port for Ratchet Websocket

Here’s the code I have to set Ratchet based Websocket:

        $server = IoServer::factory(
        new \HelpieChat\Server\Socket_Interface(),
         8081,
        '0.0.0.0'
         );
    
       $server->run();

But I get:
Uncaught RuntimeException: Failed to listen on “tcp://0.0.0.0:3001”: Address already in use in. This works fine in MAMP.

How do I make this work in Local?