-
Notifications
You must be signed in to change notification settings - Fork 190
feat(rivetkit): expose getGatewayUrl #3975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,18 @@ import { combineUrlPath } from "@/utils"; | |
| import { getEndpoint } from "./api-utils"; | ||
| import { logger } from "./log"; | ||
|
|
||
| export function buildActorGatewayUrl( | ||
| endpoint: string, | ||
| actorId: string, | ||
| token: string | undefined, | ||
| path = "", | ||
| ): string { | ||
| const tokenSegment = | ||
| token !== undefined ? `@${encodeURIComponent(token)}` : ""; | ||
| const gatewayPath = `/gateway/${encodeURIComponent(actorId)}${tokenSegment}${path}`; | ||
| return combineUrlPath(endpoint, gatewayPath); | ||
| } | ||
|
Comment on lines
+16
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new buildActorGatewayUrl function might not be properly formatted according to Biome standards. Run the Biome formatter on this file to ensure proper spacing, indentation, and line breaks. Also, ensure the imports at the top of the file are properly sorted. Spotted by Graphite Agent (based on CI logs) |
||
|
|
||
| export async function openWebSocketToActor( | ||
| runConfig: ClientConfig, | ||
| path: string, | ||
|
|
@@ -24,13 +36,12 @@ export async function openWebSocketToActor( | |
|
|
||
| // WebSocket connections go through guard | ||
| const endpoint = getEndpoint(runConfig); | ||
| let gatewayPath; | ||
| if (runConfig.token !== undefined) { | ||
| gatewayPath = `/gateway/${encodeURIComponent(actorId)}@${encodeURIComponent(runConfig.token)}${path}`; | ||
| } else { | ||
| gatewayPath = `/gateway/${encodeURIComponent(actorId)}${path}`; | ||
| } | ||
| const guardUrl = combineUrlPath(endpoint, gatewayPath); | ||
| const guardUrl = buildActorGatewayUrl( | ||
| endpoint, | ||
| actorId, | ||
| runConfig.token, | ||
| path, | ||
| ); | ||
|
|
||
| logger().debug({ | ||
| msg: "opening websocket to actor via guard", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import statement needs to be sorted correctly according to Biome's rules. Run 'biome format --write .' to fix import sorting.
Spotted by Graphite Agent (based on CI logs)

Is this helpful? React 👍 or 👎 to let us know.