Skip to main content

land_scheme_handler_async

Function land_scheme_handler_async 

Source
pub fn land_scheme_handler_async<R: Runtime>(
    _ctx: UriSchemeContext<'_, R>,
    request: Request<Vec<u8>>,
    responder: UriSchemeResponder,
)
Expand description

Handles land:// custom protocol requests asynchronously

This is the asynchronous version of land_scheme_handler that uses Tauri’s UriSchemeResponder to respond asynchronously, allowing the request processing to happen in a separate thread.

This is the recommended handler for production use as it provides better performance and doesn’t block the main thread.

§Parameters

  • _ctx: The URI scheme context (not used in current implementation)
  • request: The incoming webview request with URI path and headers
  • responder: The responder to send the response back asynchronously

§Platform Support

  • macOS, Linux: Uses land://localhost/ as Origin
  • Windows: Uses http://land.localhost/ as Origin by default

§Example

tauri::Builder::default()
	.register_asynchronous_uri_scheme_protocol("land", |_ctx, request, responder| {
		land_scheme_handler_async(_ctx, request, responder)
	})

Note: This implementation uses thread spawning as a workaround since Tauri 2.x’s async scheme handler API requires specific runtime setup. The thread-based approach works correctly and is production-ready.