loganwright / SimpleChat

An Easy To Use Bubble Chat Interface
Mozilla Public License 2.0
262 stars 53 forks source link

Adding Push functionality #17

Closed jtomaslobo closed 9 years ago

jtomaslobo commented 9 years ago

Hey, I am kind of confused right now trying to figure out how to add push functionality in this chat.

By that I mean, what action should I trigger whenever I receive a push message in order to print the incoming message in the chatcontroller asynchronally?

Thanks for the help

loganwright commented 9 years ago

This is a difficult question to answer without knowing the architecture of your app, so we might need to get a bit more info.

The method to add a new message is called: addNewMessage:. Here's how you would add a new message to your chat:

NSString *message = @"Get your message content here";
LGChatMessage *newMessage = [[LGChatMessage alloc] initWithContent:message sentByString:[LGChatMessage SentByUserString]];

Then, get a reference to your chat controller and call this:

[yourChatController addNewMessage:newMessage];

Does that answer your question?

jtomaslobo commented 9 years ago

Thanks a lot for the answer. I think it is going to work.

I will work on it and let you know how it goes.

loganwright commented 9 years ago

No problem, let me know if you have issues!

Best,

Logan