gateio / gatews

Gate Websocket V4 SDK
91 stars 35 forks source link

Please report connection state of underling websocket connection #8

Closed m11y closed 3 years ago

revilwang commented 3 years ago

This issue is unclear of the programming language used, what connection state and why do you need it

m11y commented 3 years ago

The websocket connection may be broken at some time,its good that gate sdk will do auto reconnect,but our business need to know the market is acutally do not available when connection is broken.

Perhaps provide a method like below:


type ConnState string

const (
    Connected ...
    Connecting ...
    Disconnected ...
)

func (ws *WsService) GetConnState() ConnState {
    // ...
}
Sinclair-Ni commented 3 years ago

The websocket connection may be broken at some time,its good that gate sdk will do auto reconnect,but our business need to know the market is acutally do not available when connection is broken.

Perhaps provide a method like below:


type ConnState string

const (
    Connected ...
    Connecting ...
    Disconnected ...
)

func (ws *WsService) GetConnState() ConnState {
  // ...
}

at v0.1.8 Release has added a method GetConnection() to get the connection. You can use this connection to solve the situation of you. And you can visit gorilla/websocket to get more info.

revilwang commented 3 years ago

Close due to long time inactivity