Push notification types
Three push notification types are available to use in
NexJ applications. Long polling and data streaming are Comet modes that
require the server to notify the client of new information. Client polling
relies on the client to check for updates.
- Data Streaming
- When the client requests information from the server, the server holds the request indefinitely. As information becomes available to the server, it is pushed to the client by writing it to the output stream of the response continuously.
- Long Polling
- When the client requests information from the server, the server holds the request until a notification is ready to be pushed to the client. After information becomes available to the server, a completed response is pushed to the client and the connection closes. The client immediately registers for push notifications again in order to continue receiving updates.
- Client Polling
- The client periodically polls for new data from the server. Because the client is constantly checking for new updates, this solution does not rely on the server for push notifications. However, this mode is neither real time nor scalable and constant client requests can overload the server.