use-stomp
Version:
react provider, class decorator, and a hook for websockets using the stomp protocol
11 lines (10 loc) • 436 B
TypeScript
import React from 'react';
export declare type WithUseStompProps<T, M> = T & {
message: M;
sendMessage: (message: M) => void;
connected: boolean;
};
/** decorator for legacy class-based components; pass the channel to subscribe.
* latest message and function for sending message are added to the class
*/
export default function withUseStomp<T, M>(channel: string): (Component: any) => React.FC<WithUseStompProps<T, M>>;