2018-09-04 22:55:52 +00:00
|
|
|
package message
|
|
|
|
|
|
|
|
import "errors"
|
|
|
|
|
|
|
|
type Extension func(message *Message)
|
|
|
|
|
|
|
|
type Message struct {
|
|
|
|
Channel string `json:"channel,omitempty"`
|
|
|
|
Version string `json:"version,omitempty"`
|
|
|
|
SupportedConnectionTypes []string `json:"supportedConnectionTypes,omitempty"`
|
2018-09-04 23:22:43 +00:00
|
|
|
ConnectionType string `json:"connectionType,omitempty"`
|
2018-09-04 22:55:52 +00:00
|
|
|
MinimumVersion string `json:"minimumVersion,omitempty"`
|
|
|
|
Successful bool `json:"successful,omitempty"`
|
|
|
|
Ext interface{} `json:"ext,omitempty"`
|
|
|
|
Id string `json:"id,omitempty"`
|
|
|
|
ClientId string `json:"clientId,omitempty"`
|
|
|
|
Advice Advise `json:"advice,omitempty"`
|
|
|
|
Data interface{} `json:"data,omitempty"`
|
|
|
|
Timestamp uint64 `json:"timestamp,omitempty"`
|
|
|
|
AuthSuccessful bool `json:"authSuccessful,omitempty"`
|
|
|
|
Error string `json:"error,omitempty"`
|
|
|
|
Subscription string `json:"subscription,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Message) GetError() error {
|
|
|
|
if m.Error == "" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return errors.New(m.Error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type Advise struct {
|
|
|
|
Reconnect string `json:"reconnect,omitempty"`
|
|
|
|
Interval int64 `json:"interval,omitempty"`
|
|
|
|
Timeout int64 `json:"timeout,omitempty"`
|
|
|
|
}
|