import * as react_jsx_runtime from 'react/jsx-runtime'; import * as _stomp_stompjs from '@stomp/stompjs'; import { StompConfig, messageCallbackType, StompHeaders, IPublishParams, IMessage } from '@stomp/stompjs'; export { ActivationState, Client, IFrame, IMessage, IPublishParams, IRawFrameType, IStompSocket, IStompSocketMessageEvent, ITransaction, RawHeaderType, StompConfig, StompHeaders, StompSocketState, closeEventCallbackType, debugFnType, frameCallbackType, messageCallbackType, wsErrorCallbackType } from '@stomp/stompjs'; import React, { ReactNode } from 'react'; interface StompSessionProviderProps extends StompConfig { /** * The URL to connect to the STOMP broker. * The URL can be a SockJS URL (http(s)://) or a raw Websocket URL (ws(s)://). */ url: string; children: ReactNode; /** * If the STOMP connection should be enabled/disabled. Defaults to true. */ enabled?: boolean; /** * The name of the StompSessionContext. * This can be used to mix multiple StompSessionProviders/Stomp Connections in the same application. * The default name is "default". When using a custom name, the same name must be specified as a parameter for all hooks and hocs. * */ name?: string; } /** * The StompSessionProvider manages the STOMP connection * All Hooks and HOCs in this library require an ancestor of this type. * The URL to connect to can be specified via the url prop. * Depending on the Schema of the URL either Sockjs or a raw Websocket is used. * You can override this behavior with the brokerURL or webSocketFactory props, which will then be forwarded to @stomp/stompjs * Custom @stomp/stompjs options can be used as props. * Please consult the @stomp/stompjs documentation for more information. */ declare function StompSessionProvider(props: StompSessionProviderProps): react_jsx_runtime.JSX.Element; /** * * @param destinations The destinations to subscribe to. Can be a string for a single destination or an array of strings for multiple. * @param onMessage Callback called when a message arrives for this subscription * @param headers Additional Headers for this subscription, consult @stomp/stompjs docs. * @param name Name of the StompSessionProvider to use. Default is "default" */ declare function useSubscription(destinations: string | string[], onMessage: messageCallbackType, headers?: StompHeaders, name?: string): void; /** * Returns the Stomp Client from @stomp/stompjs * This will be undefined if the client is currently not connected */ declare function useStompClient(name?: string): _stomp_stompjs.Client | undefined; declare function withStompClient

(WrappedComponent: React.ComponentType

, name?: string): { (props: P): react_jsx_runtime.JSX.Element; displayName: string; }; interface MessageReceiverInterface { onMessage: messageCallbackType; } type StompMessageReceiver

= React.ComponentClass

& { new (props: P, context?: unknown): React.Component

& MessageReceiverInterface; }; declare function withSubscription

(WrappedComponent: StompMessageReceiver

, destinations: string | string[], headers?: StompHeaders, name?: string): { (props: P): react_jsx_runtime.JSX.Element; displayName: string; }; /** * A mock StompSessionProvider. * Messages send via this mock implementation can be received via the getSentMockMessages method. * Subscriptions can be received via the getMockSubscriptions method. * The sendMockMessage method can be used, to simulate receiving a message from the server. * * @param props.client Optional. Can be used to provide a custom mock of the stompjs client, * in case you require additional properties/functions to be present. getMockClient can be used as a base. * @param props.name Optional. The name of the StompSessionProvider. Default is "default" * @constructor */ declare function StompSessionProviderMock(props: { children: React.ReactNode; client?: unknown; name?: string; }): react_jsx_runtime.JSX.Element; /** * A mock implementation of the publish function of the @stomp/stompjs client. * Will store the messages in a map, keyed by the destination. * @param params */ declare function mockClientPublish(params: IPublishParams): void; /** * Gets a default Mock of the @stomp/stompjs client. * If you require a custom client, you can use this as a base. */ declare function getMockClient(): { publish: typeof mockClientPublish; }; /** * Gets all messages which have been sent via a mock client. * @param destination The destination to get messages for, or undefined to get all messages. */ declare function getSentMockMessages(destination?: string): IPublishParams[] | Map | undefined; /** * Simulates receiving a message from the server to the specified destination * @param destination The topic to send the message to * @param message The message to send */ declare function mockReceiveMessage(destination: string, message: IMessage): void; /** * Gets the current subscriptions for the specified destination * @param destination The topic to get the subscriptions for, or undefined to get all subscriptions */ declare function getMockSubscriptions(destination?: string): Map | Map> | undefined; /** * Resets the state of the mock implementation, clearing all subscriptions and messages. */ declare function reset(): void; declare const index_StompSessionProviderMock: typeof StompSessionProviderMock; declare const index_getMockClient: typeof getMockClient; declare const index_getMockSubscriptions: typeof getMockSubscriptions; declare const index_getSentMockMessages: typeof getSentMockMessages; declare const index_mockClientPublish: typeof mockClientPublish; declare const index_mockReceiveMessage: typeof mockReceiveMessage; declare const index_reset: typeof reset; declare namespace index { export { index_StompSessionProviderMock as StompSessionProviderMock, index_getMockClient as getMockClient, index_getMockSubscriptions as getMockSubscriptions, index_getSentMockMessages as getSentMockMessages, index_mockClientPublish as mockClientPublish, index_mockReceiveMessage as mockReceiveMessage, index_reset as reset }; } export { StompSessionProvider, index as mock, useStompClient, useSubscription, withStompClient, withSubscription };