
- 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.
64 lines
1.5 KiB
Markdown
64 lines
1.5 KiB
Markdown
# stream-events
|
|
|
|
> Get an event when you're being sent data or asked for it.
|
|
|
|
## About
|
|
|
|
This is just a simple thing that tells you when `_read` and `_write` have been called, saving you the trouble of writing this yourself. You receive two events `reading` and `writing`-- no magic is performed.
|
|
|
|
This works well with [duplexify](https://github.com/mafintosh/duplexify) or lazy streams, so you can wait until you know you're being used as a stream to do something asynchronous, such as fetching an API token.
|
|
|
|
|
|
## Use
|
|
```sh
|
|
$ npm install --save stream-events
|
|
```
|
|
```js
|
|
var stream = require('stream')
|
|
var streamEvents = require('stream-events')
|
|
var util = require('util')
|
|
|
|
function MyStream() {
|
|
stream.Duplex.call(this)
|
|
streamEvents.call(this)
|
|
}
|
|
util.inherits(MyStream, stream.Duplex)
|
|
|
|
MyStream.prototype._read = function(chunk) {
|
|
console.log('_read called as usual')
|
|
this.push(new Buffer(chunk))
|
|
this.push(null)
|
|
}
|
|
|
|
MyStream.prototype._write = function() {
|
|
console.log('_write called as usual')
|
|
}
|
|
|
|
var stream = new MyStream
|
|
|
|
stream.on('reading', function() {
|
|
console.log('stream is being asked for data')
|
|
})
|
|
|
|
stream.on('writing', function() {
|
|
console.log('stream is being sent data')
|
|
})
|
|
|
|
stream.pipe(stream)
|
|
```
|
|
|
|
### Using with Duplexify
|
|
```js
|
|
var duplexify = require('duplexify')
|
|
var streamEvents = require('stream-events')
|
|
var fs = require('fs')
|
|
|
|
var dup = streamEvents(duplexify())
|
|
|
|
dup.on('writing', function() {
|
|
// do something async
|
|
dup.setWritable(/*writable stream*/)
|
|
})
|
|
|
|
fs.createReadStream('file').pipe(dup)
|
|
``` |