Debugging your first remote WebSocket server
In the previous recipe, we learnt how to debug a WebSocket server that is running locally. In this recipe, we will learn how to debug it if it is running on another or a remote machine.
The steps are more or less the same as we took in the previous recipe except for the debug configuration section where we will change the localhost to the remote machine IP or DNS and start the Delve server, which is a debugger for the Go programming language on the remote machine.
How to do it…
- Add another configuration by clicking on
Edit Configurations...as shown in the following screenshot:

- Click on the + sign to
Add New ConfigurationandselectGo Remote:

- Rename the debug configuration to
WebSocket Remote Debug, change theHosttoremote-machine-IPorDNS, and click onApplyandOKas shown in thefollowingscreenshot:

- Run a headless Delve server on the target or remote machine by executing the following command:
dlv debug --headless --listen=:2345 --api-version=2The preceding...