-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a5b4b8
commit 20b78e7
Showing
1 changed file
with
3 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
import { grpc } from '@improbable-eng/grpc-web' | ||
import { NodeHttpTransport } from '@improbable-eng/grpc-web-node-http-transport' | ||
import { ReactNativeTransport } from '@improbable-eng/grpc-web-react-native-transport' | ||
import { isBrowser, isNode, isReactNative } from './helpers' | ||
import { isNode, isReactNative } from './helpers' | ||
|
||
export const getGrpcTransport = (): grpc.TransportFactory | undefined => { | ||
if (isBrowser()) { | ||
return undefined | ||
if (isReactNative()) { | ||
return ReactNativeTransport({ withCredentials: true }) | ||
} | ||
|
||
if (isNode()) { | ||
return NodeHttpTransport() | ||
} | ||
|
||
if (isReactNative()) { | ||
return ReactNativeTransport({ withCredentials: true }) | ||
} | ||
|
||
return undefined | ||
} |