mochi-mqtt / server

The fully compliant, embeddable high-performance Go MQTT v5 server for IoT, smarthome, and pubsub
MIT License
1.29k stars 222 forks source link

Add some error logging in Listener.Serve(). #303

Closed werbenhu closed 1 year ago

werbenhu commented 1 year ago

When I use an incorrect WebSocket address (for example, go run main.go -ws=1882 where there is a missing colon before '1882'), it's challenging to pinpoint and discover where the problem lies. The server appears to be running fine. I suggest adding some error logging in Listener.Serve() to assist with troubleshooting.

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 6285127154


Totals Coverage Status
Change from base Build 6277994351: 0.003%
Covered Lines: 5435
Relevant Lines: 5495

💛 - Coveralls
dgduncan commented 1 year ago

Should this be added to every listener? It seems like it would make sense that we bubble up the same error on every listener to make sure that the same issue does not effect the others.

werbenhu commented 1 year ago

@dgduncan As it stands now, I believe we should, at the very least, add error logging within the Serve() methods of the WebSocket and HTTPStats listeners.