websocket: Relay disconnect errors to subscribers (#1347)

* WS: Relay disconnect errors to subscribers

Subscribers probably care when the WS got disconncted.
Tell them and expose a method to test the error for matching

* Fix linter error
This commit is contained in:
Gareth Kirwan
2023-09-14 01:14:04 +01:00
committed by GitHub
parent bcabf44b8c
commit c8ec22fe92
3 changed files with 14 additions and 13 deletions

View File

@@ -216,7 +216,7 @@ func (w *WebsocketConnection) IsConnected() bool {
func (w *WebsocketConnection) ReadMessage() Response {
mType, resp, err := w.Connection.ReadMessage()
if err != nil {
if isDisconnectionError(err) {
if IsDisconnectionError(err) {
if w.setConnectedStatus(false) {
// NOTE: When w.setConnectedStatus() returns true the underlying
// state was changed and this infers that the connection was