UNPKG

atozas-push-notification

Version:

Real-time push notifications across platforms using socket.io

90 lines 2.37 kB
import { ServerConfig, UserInfo, NotificationData, NotificationOptions, SendNotificationParams } from './types'; export declare class AtozasPushNotificationServer { private io; private httpServer; private connectedUsers; private userSocketMap; private groups; constructor(config?: ServerConfig); /** * Start the server on specified port */ listen(port: number): void; /** * Send notification to specific user(s), group(s), or broadcast to all */ sendNotification(params: SendNotificationParams): boolean; /** * Send notification to multiple users */ sendToUsers(userIds: string[], notification: NotificationData, options?: NotificationOptions): boolean; /** * Send notification to multiple groups */ sendToGroups(groupIds: string[], notification: NotificationData, options?: NotificationOptions): boolean; /** * Get list of connected users */ getConnectedUsers(): UserInfo[]; /** * Get user connection status */ isUserOnline(userId: string): boolean; /** * Get users in a specific group */ getGroupUsers(groupId: string): string[]; /** * Get all groups */ getAllGroups(): string[]; /** * Add user to group programmatically */ addUserToGroup(userId: string, groupId: string): boolean; /** * Remove user from group programmatically */ removeUserFromGroup(userId: string, groupId: string): boolean; /** * Get server statistics */ getStats(): any; /** * Disconnect user */ disconnectUser(userId: string, reason?: string): boolean; /** * Send notification to a specific user */ private sendToUser; /** * Send notification to a group */ private sendToGroup; /** * Broadcast notification to all connected users */ private sendBroadcast; /** * Setup socket event handlers */ private setupEventHandlers; /** * Handle user authentication */ private handleUserAuthentication; /** * Handle joining a group */ private handleJoinGroup; /** * Handle leaving a group */ private handleLeaveGroup; /** * Handle user disconnection */ private handleUserDisconnection; } //# sourceMappingURL=server.d.ts.map