Skip to content

HelixClient: custom base url without mock_api feature #444

@Disorrder

Description

@Disorrder

I'm trying to use Twitch CLI and utilize its websocket mock server.
The websocket server is hosted on ws://127.0.0.1:8080/ws
And I need to send subscriptions to http://127.0.0.1:8080/eventsub/subscriptions
Thanks to this example I can specify websocket url:

        let (socket, _) = tokio_tungstenite::connect_async_with_config(
            twitch_api::TWITCH_EVENTSUB_WEBSOCKET_URL.clone().as_str(),
            Some(config),
            false,
        )

but there're no way to specify url for HelixClient (to call create_eventsub_subscription)

    fn get_uri(&self) -> Result<http::Uri, InvalidUri> {
        let query = self.query()?;
        let url = crate::TWITCH_HELIX_URL
            .join(<Self as Request>::PATH)
            .map(|mut u| {
                u.set_query(Some(&query));
                u
            })?;
        http::Uri::from_str(url.as_str()).map_err(Into::into)
    }

If I set TWITCH_HELIX_URL and TWITCH_EVENTSUB_WEBSOCKET_URL in .env, I can't use HelixClient for production request like getting channel info etc. So, I think there's only a workaround to use custom client to send subscription requests, but I would have it in your crate like HelixClient::with_config(...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions