Debugging your first local WebSocket server
Debugging a web application is one of the most important skills for a developer to learn, as it helps in identifying a problem, isolating the source of the problem, and then either correcting the problem or determining a way to work around it. In this recipe, we will learn how to debug a WebSocket server running locally using GoLand IDE.
Getting ready…
This recipe assumes you have GoLand IDE installed and configured to run the Go Application on your machine.
How to do it…
- Click Open Projectin the GoLand IDE to openwebsocket-server.go, which we wrote in our previous recipe, as shown in the following screenshot:

- Once the project opens, click onEdit Configurationsasshownin the following screenshot:

- Select Add New Configurationby clicking the+sign as shown in the following screenshot:

- Select Go Build, rename theconfigurationtoWebSocket Local Debug, changeRun kindtoDirectory, and click onApplyandOKas shown in the following screenshot:

- Place a few breakpoints...
 
                                             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
     
         
                 
                 
                 
                 
                 
                 
                 
                 
                 
        