File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 5353``` TypeScript
5454import { QueryClientProvider , QueryClient } from ' react-query' ;
5555import { ReactQueryDevtools } from ' react-query/devtools' ;
56- import { useSubscription , eventSource$ } from ' react-query-subscription' ;
56+ import { useSubscription } from ' react-query-subscription' ;
57+ import { eventSource$ } from ' rx-event-source' ;
5758
5859const queryClient = new QueryClient ();
5960
@@ -69,6 +70,7 @@ function App() {
6970function SseExample() {
7071 const { data, isLoading, isError, error } = useSubscription (
7172 ' some-key' ,
73+ // @see https://kaciakmaciak.github.io/rx-event-source/modules.html#eventSource_
7274 () => eventSource$ (' /api/v1/sse' ),
7375 {
7476 // options
@@ -89,6 +91,8 @@ function SseExample() {
8991}
9092```
9193
94+ See [ ` rx-event-source ` docs] ( https://kaciakmaciak.github.io/rx-event-source ) .
95+
9296### GraphQL subscription using [ ` graphql-ws ` ] ( https://github.com/enisdenjo/graphql-ws )
9397
9498``` TypeScript
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ export interface EventSourceOptions<TData = unknown> {
1717/**
1818 * Takes EventSource and creates an observable from it.
1919 *
20+ * @deprecated Use `fromEventSource` from `rx-event-source` package instead.
21+ *
2022 * @example
2123 * ```ts
2224 * const sse = new EventSource(url, configuration);
@@ -60,6 +62,8 @@ export function fromEventSource<TData = unknown>(
6062 * Opens the event source once subscribed.
6163 * Closes the event source, once unsubscribed.
6264 *
65+ * @deprecated Use `eventSource$` from `rx-event-source` package instead.
66+ *
6367 * @example
6468 * ```ts
6569 * const sse$ = eventSource$('https://example.com/sse', {
You can’t perform that action at this time.
0 commit comments