rpaschoal / ng-chat

💬 A simple facebook/linkedin lookalike chat module for Angular applications.
MIT License
155 stars 92 forks source link

Get message using onMessageReceived #84

Closed davidalisson closed 5 years ago

davidalisson commented 5 years ago

Hi, I use in my project two chats, one for mobile app and one for web application (ng-chat). I need to the user receive a push notification on webapp when a client send a message.

I'm using Firebase RealTime Database for storage chat messages. I can get and send messages but I can't receive push notification when the mobile user send message to webapp user

rpaschoal commented 5 years ago

Hi @davidalisson ,

Assuming you have a socket opened with ng-chat you should be able to push messages whenever it is necessary.

I believe this question is more related to your project rather than ng-chat itself. I'm more than happy to help you finding a solution for what you need right now but not much I can do without having a look at the overall picture and some code.

Would you be able to provide more details such as what is your back-end written with (.NET, Nodejs, etc), what packages you are using for web sockets and to implement your adapter, etc.

davidalisson commented 5 years ago

Hi @rpaschoal, I can send and receive messages, I can also get them using getMessageHistory but I can't show a new message received instantly, I need to close the chat window and open it again to a new message sent by client appears. I'm not using back-end to send and receive messages, I do this only on the front-end. If nessessary I can show my adapter.

rpaschoal commented 5 years ago

It might be just your adapter implementation @davidalisson

Before you post your adapter here as this might be sensitive information, have you had the chance to have a look at this project? It is a nodejs + ng-chat sample: https://github.com/rpaschoal/ng-chat-nodejs

If you run this project locally you can open 2 different browser sessions and send and receive messages across. Have a look at the adapter there and see if it helps you sorting out your current issue.

Cheers!

davidalisson commented 5 years ago

Hi @rpaschoal, can you put this sample in demo folder of the project? This content helped me a lot and can help another devs. Anyway, thanks for supporting me on this! Any doubt I'll be here again :rofl:

rpaschoal commented 5 years ago

Hi @davidalisson ,

Happy to know that you've managed to sort it out 🎉

The link to the NodeJS example is right at the top of the README 😅