atozas-push-notification
Version:
Real-time push notifications across platforms using socket.io
95 lines • 2.67 kB
TypeScript
import { ClientConfig, UserInfo, NotificationData, NotificationOptions, NotificationCallback, ConnectionCallback, ErrorCallback, UserStatusCallback, NotificationPermission } from './types';
export declare class AtozasPushNotificationClient {
private socket;
private config;
private userInfo;
private isConnected;
private reconnectAttempts;
private displayManager;
private onNotificationCallback;
private onConnectionCallback;
private onErrorCallback;
private onUserStatusCallback;
constructor(config: ClientConfig);
/**
* Connect to the notification server
*/
connect(): Promise<void>;
/**
* Disconnect from the notification server
*/
disconnect(): void;
/**
* Authenticate user with the server
*/
authenticate(userInfo: UserInfo): void;
/**
* Join a group for group notifications
*/
joinGroup(groupId: string): void;
/**
* Leave a group
*/
leaveGroup(groupId: string): void;
/**
* Set notification callback handler
*/
onNotification(callback: NotificationCallback): void;
/**
* Set connection status callback handler
*/
onConnection(callback: ConnectionCallback): void;
/**
* Set error callback handler
*/
onError(callback: ErrorCallback): void;
/**
* Set user status callback handler
*/
onUserStatus(callback: UserStatusCallback): void;
/**
* Get connection status
*/
getConnectionStatus(): boolean;
/**
* Get current user info
*/
getUserInfo(): UserInfo | null;
/**
* Send acknowledgment for received notification
*/
acknowledgeNotification(notificationId: string): void;
/**
* Request user status
*/
requestUserStatus(userId: string): void;
/**
* Request notification permission
*/
requestNotificationPermission(): Promise<NotificationPermission>;
/**
* Get notification permission status
*/
getNotificationPermission(): NotificationPermission;
/**
* Set notification click handler
*/
onNotificationClick(callback: (notification: NotificationData) => void): void;
/**
* Close all active notifications
*/
closeAllNotifications(): void;
/**
* Display a local notification (without sending through socket)
*/
displayLocalNotification(notification: NotificationData, options?: NotificationOptions): void;
/**
* Setup socket event handlers
*/
private setupEventHandlers;
/**
* Handle reconnection logic
*/
private handleReconnection;
}
//# sourceMappingURL=client.d.ts.map