Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Let outer know state changes immediately #57

Closed
siddontang opened this issue May 18, 2015 · 2 comments
Closed

Let outer know state changes immediately #57

siddontang opened this issue May 18, 2015 · 2 comments

Comments

@siddontang
Copy link

I know that we can use State() function to check current connection state, but can not know the state changes immediately.

In setState, there is a eventChan but it can not used outer, only in test I know. Could you let it open? Maybe below:

func (c *Conn)StateCh() <-chan Event {
    return c.eventChan
}

Why I need this, if SessionExpired and reconnect ok, we can not know it any way. So now we could only re-create a new connection when expired.

@samuel
Copy link
Owner

samuel commented May 18, 2015

That same channel is returned from Connect* as the second value. It'll remain throughout the life of the *Conn instance.

func ConnectWithDialer(servers []string, sessionTimeout time.Duration, dialer Dialer) (*Conn, <-chan Event, error) {

@siddontang
Copy link
Author

Sorry, I haven't seen this before, thank you very much. :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants