How to send automatic notification for new message?


#1

I need to create web based chat application with 1-1 and group chat.
For that we have selected rocket chat and I am looking at rest api doc
https://rocket.chat/docs/developer-guides/rest-api/

But here I am not sure what i can use for sending push notification to browser(Better i say listen to new incoming message) as I have web based application when there is new message.

Or should I use https://rocket.chat/docs/developer-guides/realtime-api for such function?


#2

The Real-Time API provides a stream of everything that is happening on a server.

I made a small/quick example of how to connect to the stream that might help you get started - https://github.com/JSzaszvari/rocketchat-ddp-listener

sending push notification to browser

I’m not sure what you mean by this, if you have notifications turned on, you will also get browser notifications if the browser supports it.


#3

hey thanks for your reply, I am totally newbie to rocketchat.

Let me make an example,
I need to make realtime chat in asp.net web application, planning to use rocket chat.
If I use an API send message to user A then with which API I can display message to user A automatically?
Can I this ddp listener use with jQuery/Javascript client side?


#4

Yes basically you’d establish the connection and then subscribe to the event, and perform what ever logic you would like with the received message.