use-stomp
Version:
react provider, class decorator, and a hook for websockets using the stomp protocol
12 lines (11 loc) • 658 B
TypeScript
import React from 'react';
import { StompNotification, StompNotistackOptions } from './useStompNotifications';
export declare type WithUseStompNotificationsProps<T, M> = T & {
connected: boolean;
messages: StompNotification<M>[];
sendMessage: (message: any) => void;
};
/** decorator for legacy class-based components; pass the channel to subscribe.
* it will add a lists prop, which contains all the notifications to display
*/
export default function withUseStompNotifications<OtherProps, Message>(channel: string, options?: StompNotistackOptions<Message>): (Component: any) => React.FC<WithUseStompNotificationsProps<OtherProps, Message>>;