I made a typo in my code sample, the third string should be `ws:`:

    'https:' ? 'wss:' : 'ws:'