wind-c / comqtt

A lightweight, high-performance go mqtt server(v3.0|v3.1.1|v5.0) supporting distributed cluster
MIT License
877 stars 50 forks source link

About client lifecycle #8

Closed wwhai closed 1 year ago

wwhai commented 1 year ago

Description

Should add an event interface which named OnConnected, Because that's only have OnConnect , But it seems only suit for todo something BEFORE connect,when we open Auth plugin,'OnConnected' maybe not trigger if auth failure。 image

Such bellow

type Events struct {
    OnProcessMessage // published message receieved before evaluation.
    OnMessage          // published message receieved.
    OnError                // server error.
    OnConnect           // client ready connect.
        OnConnected        // client connected.
    OnDisconnect       // client disconnected.
    OnSubscribe        // topic subscription created.
    OnUnsubscribe    // topic subscription removed.
}
wind-c commented 1 year ago

Authentication failure is also an error and can be detected by events#OnError.