-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging 5be2973 into trunk-temp/pr-1201/11320499-b336-4dd6-ae8b-61da3…
…f79d54c
- Loading branch information
Showing
1 changed file
with
14 additions
and
1 deletion.
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,8 +1,21 @@ | ||
import { createConnectTransport } from "@connectrpc/connect-node"; | ||
import { | ||
createConnectTransport, | ||
Http2SessionManager, | ||
} from "@connectrpc/connect-node"; | ||
|
||
export function createTransport(baseUrl: string) { | ||
// We create our own session manager so we can attempt to pre-connect | ||
const sessionManager = new Http2SessionManager(baseUrl, { | ||
// AWS ALB doesn't support PING so we use a very high idle timeout | ||
idleConnectionTimeoutMs: 600 * 1000, | ||
}); | ||
|
||
// We ignore the promise result because this is an optimistic pre-connect | ||
sessionManager.connect(); | ||
|
||
return createConnectTransport({ | ||
baseUrl, | ||
httpVersion: "2", | ||
sessionManager, | ||
}); | ||
} |