MCPcopy Index your code
hub / github.com/TanStack/ai / useConnection

Function useConnection

testing/react-native-smoke/src/App.tsx:30–41  ·  view source on GitHub ↗
(transport: TransportKey)

Source from the content-addressed store, hash-verified

28}
29
30function useConnection(transport: TransportKey): ConnectionAdapter {
31 return useMemo(() => {
32 switch (transport) {
33 case 'fetch-http':
34 return fetchHttpStream(chatUrl)
35 case 'xhr-sse':
36 return xhrServerSentEvents(chatUrl)
37 case 'xhr-http':
38 return xhrHttpStream(chatUrl)
39 }
40 }, [transport])
41}
42
43export default function App() {
44 const [transport, setTransport] = useState<TransportKey>('fetch-http')

Callers 1

AppFunction · 0.70

Calls 3

fetchHttpStreamFunction · 0.85
xhrServerSentEventsFunction · 0.85
xhrHttpStreamFunction · 0.85

Tested by

no test coverage detected