Messaging Services for Mobile Apps

Sangharsh Aglave, Software Engineer

The Mobile App Services (MAS) Messaging service lets you create collaborative mobile apps where the app users can send message to each other. The MAS Messaging SDK uses MQTT protocol, a publish- subscribe based message protocol to send and receive messages. App users can subscribe, publish, and listen to the messages based on the topic of the messages. Our MAG has the broker installed to facilitates the publishing and subscribing of messages. You can accomplish the messaging tasks by using the following MAS Messaging methods:

  • Connect – Establishes a connection with the server.
  • Subscribe – Subscribes a user to a topic
  • Unsubscribe – Unsubscribes a user from a topic.
  • Publish – Publishes a message to a topic.
  • Disconnect – Disconnects from the server.

Now let us get started with the MAS Messaging by downloading the MAS Messaging plugin from our Cordova repository. Now to add the MAS Messaging plugin to your project, follow these steps:

1.      Open a terminal window.

2.      Run the following command to add the plugin to your project:

ionic plugin add PATH_TO_PLUGIN

3.      Call the following method to listen to a message that is received on your topic (i.e.your username):

MASConnectaPlugin.MASUser.startListeningToMyMessages(successHandler, errorHandler);

4.      Call the following method to register a listener that is called every time you receive a message:

MASConnectaPlugin.MASRegisterListener(successHandler, errorHandler);

5.      Call the following method to send message to a user:

MASConnectaPlugin.MASUser.sendMessageToUser(successHandler, errorHandler, message, username);

You’re all set to send and receive messages on your app.

 We now have a complete messaging app ready. For further details, head over to our documentation.

Sangharsh Aglave, Software Engineer, CA Technologies

Sangharsh Aglave is a Software Engineer at CA Technologies. He works in the API Management Business Unit where he works on mobile technologies on the Mobile App Services product.

Sangharsh graduated from the Computer Science Department at Indian Institute of Technology, Kanpur in 2015. He worked as a summer intern at CA and consequently joined CA as a college recruit after graduation. He has a keen interest in mobile technologies and has worked on both iOS and Android platforms. He also likes to explore emerging fields in Computer Science like machine learning and artificial intelligence.

Chat
What would you like to chat about?
Support
Contact
Call us at 1-800-225-5224
Call us at 1-800-225-5224
Contact Us

Chat with CA

Just give us some brief information and we'll connect you to the right CA ExpertCA sales representative.

Our hours of availability are 8AM - 5PM CST.

All Fields Required

connecting

We're matching your request.

Unfortunately, we can't connect you to an agent. If you are not automatically redirected please click here.

  • {{message.agentProfile.name}} will be helping you today.

    View Profile


  • Transfered to {{message.agentProfile.name}}

    {{message.agentProfile.name}} joined the conversation

    {{message.agentProfile.name}} left the conversation

  • Your chat with {{$storage.chatSession.messages[$index - 1].agentProfile.name}} has ended.
    Thank you for your interest in CA.


    Rate Your Chat Experience.

    {{chat.statusMsg}}

agent is typing