• Eduardo Sanz García's avatar
    Respond to the first port request, ignore additional ones · e78ada77
    Eduardo Sanz García authored
    On Chrome, transferring the port more than once causes an error:
    
    ```
    const {port1, port2} = new MessageChannel();
    window.postMessage('hello', '*', [port1])
    window.postMessage('hello', '*', [port1])
    > Uncaught DOMException: Failed to execute 'postMessage' on 'Window': Port at index 0 is already neutered.
        at <anonymous>:1:8
    ```
    
    As a result of `PortFinder` polling the host, `PortProvider` could
    respond multiple times, specially when the polling frequency is high.
    e78ada77
port-provider-test.js 5.24 KB