I am looking for a function. A global function that might do me the work of sending the stream packet to the client.

in function A (Server, From, attrs)-> I construct the xml element PacketToBeSent = "Packet + attrs" and so on....,

I would need a function to send froms server to client directly in this server. something like

ejabberd:somefunction(Server, From,PacketToBeSent).

I have used the ejabbered_router:route(Server, From,PacketToBeSent) but this deals with presences and many things that I dont want and need.

有帮助吗?

解决方案

Providing that you have the recipient logged in, you can use:

ejabberd_c2s:handle_info({send_text, Text}, StateName, StateData) ->

or even send_element(StateData, El). But that is all valid if you have recipients PID or socket.

ejabberd_router:route, may be much better because it deals with offline users.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top