1234567891011121314151617181920212223242526 |
- package mqtt_client
- var clientInstance *Client
- func InitInstance(opts *ClientOptions) {
- if clientInstance == nil {
- client, err := New(opts)
- if err != nil {
- panic(err)
- }
- clientInstance = client
- }
- }
- func DestroyInstance() {
- if clientInstance == nil {
- return
- }
- Destroy(clientInstance)
- }
- func GetInstance() *Client {
- return clientInstance
- }
|