How to send message alert to Online users in MSD Axapta

Create following job in AOT to send message alert to Online users in Axapta
static void sendMsgToOnlineUsers(Args _args)
Eventmsgbox msgbox;
EventmsgboxId msgboxId;
SysClientclientsessions1 clientsessions1;
while select clientsessions1
where clientsessions1.Status == clientsessions1tate::Running
msgboxId = Eventmsgbox::nextEventId();
msgbox.ShowPopup = NoYes::Yes;
msgbox.Subject = "Message aler";
msgbox.Message = "Message testing from ax application";
msgbox.SendEmail = false;
msgbox.UserId = clientsessions1.userId;
msgbox.msgboxId = msgboxId;
msgbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();