
- 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.
120 lines
3.7 KiB
TypeScript
120 lines
3.7 KiB
TypeScript
import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface';
|
|
/**
|
|
* External interface
|
|
* @see https://github.com/socketio/socket.io/blob/master/lib/index.ts
|
|
* @publicApi
|
|
*/
|
|
export interface GatewayMetadata {
|
|
/**
|
|
* The name of a namespace
|
|
*/
|
|
namespace?: string | RegExp;
|
|
/**
|
|
* Name of the path to capture
|
|
* @default "/socket.io"
|
|
*/
|
|
path?: string;
|
|
/**
|
|
* Whether to serve the client files
|
|
* @default true
|
|
*/
|
|
serveClient?: boolean;
|
|
/**
|
|
* The adapter to use
|
|
* @default the in-memory adapter (https://github.com/socketio/socket.io-adapter)
|
|
*/
|
|
adapter?: any;
|
|
/**
|
|
* The parser to use
|
|
* @default the default parser (https://github.com/socketio/socket.io-parser)
|
|
*/
|
|
parser?: any;
|
|
/**
|
|
* How many ms before a client without namespace is closed
|
|
* @default 45_000
|
|
*/
|
|
connectTimeout?: number;
|
|
/**
|
|
* How many ms without a pong packet to consider the connection closed
|
|
* @default 20_000
|
|
*/
|
|
pingTimeout?: number;
|
|
/**
|
|
* How many ms before sending a new ping packet
|
|
* @default 25_000
|
|
*/
|
|
pingInterval?: number;
|
|
/**
|
|
* How many ms before an uncompleted transport upgrade is cancelled
|
|
* @default 10_000
|
|
*/
|
|
upgradeTimeout?: number;
|
|
/**
|
|
* How many bytes or characters a message can be, before closing the session (to avoid DoS).
|
|
* @default 1e6 (1 MB)
|
|
*/
|
|
maxHttpBufferSize?: number;
|
|
/**
|
|
* A function that receives a given handshake or upgrade request as its first parameter,
|
|
* and can decide whether to continue or not. The second argument is a function that needs
|
|
* to be called with the decided information: fn(err, success), where success is a boolean
|
|
* value where false means that the request is rejected, and err is an error code.
|
|
*/
|
|
allowRequest?: (req: any, fn: (err: string | null | undefined, success: boolean) => void) => void;
|
|
/**
|
|
* The low-level transports that are enabled
|
|
* @default ["polling", "websocket"]
|
|
*/
|
|
transports?: Array<'polling' | 'websocket'>;
|
|
/**
|
|
* Whether to allow transport upgrades
|
|
* @default true
|
|
*/
|
|
allowUpgrades?: boolean;
|
|
/**
|
|
* Parameters of the WebSocket permessage-deflate extension (see ws module api docs). Set to false to disable.
|
|
* @default false
|
|
*/
|
|
perMessageDeflate?: boolean | object;
|
|
/**
|
|
* Parameters of the http compression for the polling transports (see zlib api docs). Set to false to disable.
|
|
* @default true
|
|
*/
|
|
httpCompression?: boolean | object;
|
|
/**
|
|
* What WebSocket server implementation to use. Specified module must
|
|
* conform to the ws interface (see ws module api docs). Default value is ws.
|
|
* An alternative c++ addon is also available by installing uws module.
|
|
*/
|
|
wsEngine?: string;
|
|
/**
|
|
* An optional packet which will be concatenated to the handshake packet emitted by Engine.IO.
|
|
*/
|
|
initialPacket?: any;
|
|
/**
|
|
* Configuration of the cookie that contains the client sid to send as part of handshake response headers. This cookie
|
|
* might be used for sticky-session. Defaults to not sending any cookie.
|
|
* @default false
|
|
*/
|
|
cookie?: any | boolean;
|
|
/**
|
|
* The options that will be forwarded to the cors module
|
|
*/
|
|
cors?: CorsOptions;
|
|
/**
|
|
* Whether to enable compatibility with Socket.IO v2 clients
|
|
* @default false
|
|
*/
|
|
allowEIO3?: boolean;
|
|
/**
|
|
* Destroy unhandled upgrade requests
|
|
* @default true
|
|
*/
|
|
destroyUpgrade?: boolean;
|
|
/**
|
|
* Milliseconds after which unhandled requests are ended
|
|
* @default 1_000
|
|
*/
|
|
destroyUpgradeTimeout?: number;
|
|
}
|