powered by Jive Software

Intercept and reject Packets with Smack

Hi,

I want to implement a kind of buffer in my little program. In case the network is overloaded this buffer shall store all packets until the network is working fine again.

Im intercepting all packets with the PacketInterception Interface and writing them to an array, works fine for now. But I haven’t found a possibility to reject those intercepted messages yet, Smack still sends them. Does anyone have any suggestions?

Thanks in advance.

Daniel

One approach is to write your own class that you centralize all calls to XMPPConnection.sendPacket(). In this class you can either send the packet or cache it.

Alternatively, you could null out the reference to the packet in your interceptor. Looks like the PacketWriter class with handle this gracefully, although, other PacketInterceptors may not.

-Pony

Well, null out the intercepted Packet didn’t change anything,the Packets are still send, but I’ll try to centralize the Packets.

Thanks for now.

Daniel

There is currently a plugin available for openfire.

Well thanks for your answer, but i need to intercept those packets within the client. By the way, centralize the sending of the packets and intercept them at this point did it for me.

Daniel