简体   繁体   中英

protocol comparison for notification server with node.js

I'd like to implement push notification server using node.js. The basic scenario is:

  1. Some applications sends notification messages to the server.
  2. Notification server receives the request and forwards the message to uesr's mail or IM client based on user's preference.

In step 1, which protocol (eg REST, socket, HTTP/XML and so on.) would you recommend from the performance perspective?

Also in step 2, I have a plan to use node-xmpp module for IM client but for mail, which way is the best to implement? For example,

  1. Just use SMTP. (But I think this might occur performance degradation because SMTP is an expensive communication and performance depends on SMTP server capacity.
  2. use queue mechanism, in order to avoid drawbacks from the above. node.js app simply puts the message into the queue, and smtp server pulls the message.
  3. other solutions...

Thanks in advance.

With regards to what to use as a protocol, i would go for a REST interface, whereby the application posting sends a POST request to a resource associated with the USER. something along the lines of "http://example.com/rest/v1/{userID}/notifications

I personally would use json as the data/content of the rest request and have node.js write this information to a message queue. (as a json string).

You can than have xmpp readers for each user, as well as an SMTP handler reading from this queue as fast as the SMTP server allows it to go.

However, this full post is what i would do in your situation, rather than a factual response on what is best. I know JMS fairly well and i've been working a lot with rest interfaces lately, therefore this is the way i would do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM