Skip to content

Need a way to detect connection errors of websocket #226

@bynil

Description

@bynil

The error that occurred in stream reading is ignored now.

var err error
buf, err = s.codec.Read(buf[:0])
if err != nil {
if !s.isClosed() {
// log error
}
return
}

When we subscribe an event and get no messages, we can not know if the underlying websocket connection is healthy(the network may be down).

Maybe we should add a callback for all unexpected connection errors.

eg.
Subscribe(method string, callback func(b []byte), errHandler func(err error)) (func() error, error)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions