The below code works perfectly fine using VS Code on my local machine.
const connection = new signalR.HubConnectionBuilder() .withUrl("/MessageHub")