Ensure that WebSocket URL is well formed

Sets sane defaults for port option and prevents spurious slashes being inserted before the resource path.

Before: `wss://localhost:443//test`
After: `wss://localhost/test`