How to listen all message events or channel event using java


I wonder if any way to listen on message events or channel events using java.

For example:
I have 10 channels in our rocket chat system, My back-end is Java, my front end is angular js, an ios app used to send message to my front end.

In my case is the best way to integrate rocket chat to my system?

My ideal, my back-end will listen all message events, then if it is first message to a channel then i will notify that channel to front end to join the chat.

Many thanks.