I'm starting a project to build an instant messaging application for mobile devices. Although not the complete list of components these are the main data flows I'm concerned about:
Mobile app conencted to WebSocket -*for message analysis (abusive language / etc) and persistence.
Mobile app connected to MQTT broker -*for message publishing and message receiving
Mobile app connected to RESTful API -* for businness handling (balance check, token expiring, purchases, friend lists, user profile) **the different APIS can be distributed
Let me explain my concern: I want to save as much bandwidth as possible. Obviously I would prefer to have the least amount of channels but at the same time I can't just have an open connection to the message broker I need business logic in place for each message.
Because I don't want to sacrifice delivery speed I decided to have a separate channel for analysis and for message publishing (WebSocket and MQTT over TCP) instead of sending everything through websocket, and another one for business, like blocking a user, purchases, etc. (RESTful API), so based on the response from the REST API every so often I would apply some logic for sending messages.
What do you think of this approach? Do you have any suggestions?