Example #1
0
/*
 * Gets events from jabber connection,
 * if some event is happening and it is message, then it
 * goes to callback defined above
 */
func (client *Client) Listen() {
	client.Channel = make(chan *Event)
	go func() {
		client.listen = true
		for client.listen {
			C.check_xmpp_events(client.ConnInfo.ctx, 100)
		}
		C.close_xmpp_conn(client.ConnInfo)
		close(client.Channel)
		delete(clients, client.Id)
	}()
}
Example #2
0
/* Gets events from jabber connection,
if some event is happening and it is message, then it
goes to callback defined above
*/
func (client *Client) Listen() {
	client.Channel = make(chan *Message)
	go func() {
		client.listen = true
		for client.listen {
			C.check_xmpp_events(client.ConnInfo.ctx)
			time.Sleep(50 * time.Millisecond)
		}
		C.close_xmpp_conn(client.ConnInfo)
		close(client.Channel)
	}()
}