
- Complete NestJS TypeScript implementation with WebSocket support - Direct messaging (DM) and group chat functionality - End-to-end encryption with AES encryption and key pairs - Media file support (images, videos, audio, documents) up to 100MB - Push notifications with Firebase Cloud Messaging integration - Mention alerts and real-time typing indicators - User authentication with JWT and Passport - SQLite database with TypeORM entities and relationships - Comprehensive API documentation with Swagger/OpenAPI - File upload handling with secure access control - Online/offline status tracking and presence management - Message editing, deletion, and reply functionality - Notification management with automatic cleanup - Health check endpoint for monitoring - CORS configuration for cross-origin requests - Environment-based configuration management - Structured for Flutter SDK integration Features implemented: ✅ Real-time messaging with Socket.IO ✅ User registration and authentication ✅ Direct messages and group chats ✅ Media file uploads and management ✅ End-to-end encryption ✅ Push notifications ✅ Mention alerts ✅ Typing indicators ✅ Message read receipts ✅ Online status tracking ✅ File access control ✅ Comprehensive API documentation Ready for Flutter SDK development and production deployment.
node-promise-retry
Retries a function that returns a promise, leveraging the power of the retry module to the promises world.
There's already some modules that are able to retry functions that return promises but they were rather difficult to use or do not offer an easy way to do conditional retries.
Installation
$ npm install promise-retry
Usage
promiseRetry(fn, [options])
Calls fn
until the returned promise ends up fulfilled or rejected with an error different than
a retry
error.
The options
argument is an object which maps to the retry module options:
retries
: The maximum amount of times to retry the operation. Default is10
.factor
: The exponential factor to use. Default is2
.minTimeout
: The number of milliseconds before starting the first retry. Default is1000
.maxTimeout
: The maximum number of milliseconds between two retries. Default isInfinity
.randomize
: Randomizes the timeouts by multiplying with a factor between1
to2
. Default isfalse
.
The fn
function will receive a retry
function as its first argument that should be called with an error whenever you want to retry fn
. The retry
function will always throw an error.
If there are retries left, it will throw a special retry
error that will be handled internally to call fn
again.
If there are no retries left, it will throw the actual error passed to it.
If you prefer, you can pass the options first using the alternative function signature promiseRetry([options], fn)
.
Example
var promiseRetry = require('promise-retry');
// Simple example
promiseRetry(function (retry, number) {
console.log('attempt number', number);
return doSomething()
.catch(retry);
})
.then(function (value) {
// ..
}, function (err) {
// ..
});
// Conditional example
promiseRetry(function (retry, number) {
console.log('attempt number', number);
return doSomething()
.catch(function (err) {
if (err.code === 'ETIMEDOUT') {
retry(err);
}
throw err;
});
})
.then(function (value) {
// ..
}, function (err) {
// ..
});
Tests
$ npm test
License
Released under the MIT License.