### Method

# Soup Session preconnect_async

#### Declaration [src]

    void
    soup_session_preconnect_async (
      SoupSession* session,
      SoupMessage* msg,
      int io_priority,
      GCancellable* cancellable,
      GAsyncReadyCallback callback,
      gpointer user_data
    )

#### Description [src]

Start a preconnection to `msg`.

Once the connection is done, it will remain in idle state so that it can be reused by future requests. If there’s already an idle connection for the given `msg` host, the operation finishes successfully without creating a new connection. If a new request for the given `msg` host is made while the preconnect is still ongoing, the request will take the ownership of the connection and the preconnect operation will finish successfully (if there’s a connection error it will be handled by the request).

The operation finishes when the connection is done or an error occurred.

This method completes asynchronously. Use `soup_session_preconnect_finish()` inside the `GAsyncReadyCallback` to obtain the result of the operation.

#### Parameters

`msg`

  Type: `SoupMessage`

  A `SoupMessage`.

  The data is owned by the caller of the method.

`io_priority`

  Type: `int`

  The I/O priority of the request.

`cancellable`

  Type: `GCancellable`

  A `GCancellable`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`callback`

  Type: `GAsyncReadyCallback`

  The callback to invoke when the operation finishes.

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  Data for `progress_callback` and `callback`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.