I am sending messages to an ejabbered server from an android device using the REST API /api/send_message and received successfully on the server-side but after receiving a message ejabberd server not sending to the client. I am sending a message from client like this:
192.168.1.24:5443/api/send_message?"type"= "normal",&"from"= "admin@faiqkhan-Virtualbox",&"to"= "faiq@faiqkhan-Virtualbox",&"subject"= "Restart",&"body"="In 5 minutes"
I also log on_user_send_packet lister on ejabberd and print data of the packet which shows the same as I send from the client.
I am using the smack library in android.
My server side module part where I received message:
on_user_send_packet({#message{from = From, body = Body,
subject = Subject} = Packet, C2SState}) ->
?INFO_MSG("mod_stanza_ack message packet: ~p~n", [Packet]),
?INFO_MSG("mod_stanza_ack message subject: ~p~n", [Subject]),
?INFO_MSG("mod_stanza_ack message body ignored: ~p~n", [Body])
end,
{Packet, C2SState}.
Server logs:
API call send_message [{<<"type">>,<<"normal">>},{<<"from">>,<<"67456efc-be57-4cbd-a176-527de2dce19d@faiqkhan-virtualbox">>},{<<"to">>,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2@faiqkhan-virtualbox">>},{<<"subject">>,<<"Restart">>},{<<"body">>,<<"In 5 minutes">>}] from ::ffff:192.168.1.46:51597
13:43:14.298 [info] mod_stanza_ack message packet: {message,<<"4325851467592961166">>,normal,<<>>,{jid,<<"67456efc-be57-4cbd-a176-527de2dce19d">>,<<"faiqkhan-virtualbox">>,<<>>,<<"67456efc-be57-4cbd-a176-527de2dce19d">>,<<"faiqkhan-virtualbox">>,<<>>},{jid,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2">>,<<"faiqkhan-virtualbox">>,<<>>,<<"e5d6d83c-ea77-4d10-aaac-4e0e38899ac2">>,<<"faiqkhan-virtualbox">>,<<>>},[{text,<<>>,<<"Restart">>}],[{text,<<>>,<<"In 5 minutes">>}],undefined,[],#{}}
13:43:14.298 [info] mod_stanza_ack message subject: [{text,<<>>,<<"Restart">>}]
13:43:14.298 [info] mod_stanza_ack message body ignored: [{text,<<>>,<<"In 5 minutes">>}]
Trying to recevie message on client side using smack library's callback
public void newIncomingMessage(EntityBareJid from, Message message, Chat chat)
Did I miss some listeners on the client-side?