package response import ( "encoding/xml" ) type HeartEvent struct { XMLName xml.Name `xml:"heartbeat"` AccountId int64 `xml:"accountId"` Token string `xml:"token"` } func NewHeartbeatEvent(data string) *HeartEvent { r := HeartEvent{} err := xml.Unmarshal([]byte(data), &r) if err != nil { return nil } return &r }