Ejemplo n.º 1
0
//根据指定ID查询客户端在线状态,并推送消息
func (this *service) checkOnlineStatus(msg *message.PublishMessage) {
	client_id := string(msg.Payload())
	online, lasttime, _ := GetOnlineStatus(client_id)

	payload := []byte(fmt.Sprintf(`{"client_id": "%s", "status": "%s", "since": "%s"}`, client_id, online, lasttime))

	msg.SetPayload(payload)
	this.postPublish(msg)
}