diff --git a/control/cmd_event.go b/control/cmd_event.go index 2500b0b..3c9856f 100644 --- a/control/cmd_event.go +++ b/control/cmd_event.go @@ -271,11 +271,16 @@ func (c *Conn) relayAsyncEvents(resp *Response) { var dataArray []string if len(resp.Data) == 1 { // If there is a single line of data, first line of it is the code, rest of the first line is data - firstNewline := strings.Index(resp.Data[0], "\r\n") - if firstNewline == -1 { - return + // Find the index which specfies the char after the event code, either space or newline + index := strings.Index(resp.Data[0], " ") + if index == -1 { + index = strings.Index(resp.Data[0], "\r\n") + if index == -1 { + return + } } - code, data = resp.Data[0][:firstNewline], resp.Data[0][firstNewline+2:] + + code, data = resp.Data[0][:index], resp.Data[0][index+2:] } else if len(resp.Data) > 0 { // If there are multiple lines, the entire first line is the code code, dataArray = resp.Data[0], resp.Data[1:]