'How do I connect to an Infura web socket in Ethers.js?

I know in Web3js you can connect to an Infura web socket like so:

const Web3 = require('web3')
const web3 = new Web3(
  new Web3.providers.WebsocketProvider("wss://mainnet.infura.io/ws/v3/<project_id>")
)

but how do I connect using Ethers.js? I've tried searching the internet but the answer isn't immediately obvious.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source