WebKitUserMessage: WebKitGTK Reference Manual

## WebKitUserMessage WebKitUserMessage — A user message |

## Functions

WebKitUserMessage * | webkit_user_message_new ()
WebKitUserMessage * | webkit_user_message_new_with_fd_list ()
const char * | webkit_user_message_get_name ()
GVariant * | webkit_user_message_get_parameters ()
GUnixFDList * | webkit_user_message_get_fd_list ()
void | webkit_user_message_send_reply ()
GQuark | webkit_user_message_error_quark ()

## Properties

GUnixFDList * | fd-list | Read / Write / Construct Only
char * | name | Read / Write / Construct Only
GVariant * | parameters | Read / Write / Construct Only

## Types and Values

struct | WebKitUserMessage
#define | WEBKIT_USER_MESSAGE_ERROR
enum | WebKitUserMessageError

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── WebKitUserMessage

## Description

A WebKitUserMessage is a message that can be used for the communication between the UI process and web extensions. A WebKitUserMessage always has a name, and it can also include parameters and UNIX file descriptors. Messages can be sent from a WebKitWebContext to all WebKitWebExtensions, from a WebKitWebExtension to its corresponding WebKitWebContext, and from a WebKitWebView to its corresponding WebKitWebPage (and vice versa). One to one messages can be replied to directly with `webkit_user_message_send_reply()`.

## Functions

### webkit_user_message_new ()

    WebKitUserMessage *
    webkit_user_message_new (const char *name,
                             GVariant *parameters);

Create a new WebKitUserMessage with `name` .

#### Parameters

name | the message name |
parameters | the message parameters as a GVariant, or `NULL`. | [nullable]

#### Returns

the newly created WebKitUserMessage object.

Since: 2.28

### webkit_user_message_new_with_fd_list ()

    WebKitUserMessage *
    webkit_user_message_new_with_fd_list (const char *name,
                                          GVariant *parameters,
                                          GUnixFDList *fd_list);

Create a new WebKitUserMessage including also a list of UNIX file descriptors to be sent.

#### Parameters

name | the message name |
parameters | the message parameters as a GVariant. | [nullable]
fd_list | the message file descriptors. | [nullable]

#### Returns

the newly created WebKitUserMessage object.

Since: 2.28

### webkit_user_message_get_name ()

    const char *
    webkit_user_message_get_name (WebKitUserMessage *message);

Get the `message` name

#### Parameters

message | a WebKitUserMessage |

#### Returns

the message name

Since: 2.28

### webkit_user_message_get_parameters ()

    GVariant *
    webkit_user_message_get_parameters (WebKitUserMessage *message);

Get the `message` parameters

#### Parameters

message | a WebKitUserMessage |

#### Returns

the message parameters.

[transfer none]

Since: 2.28

### webkit_user_message_get_fd_list ()

    GUnixFDList *
    webkit_user_message_get_fd_list (WebKitUserMessage *message);

Get the `message` list of file descritpor

#### Parameters

message | a WebKitUserMessage |

#### Returns

the message list of file descriptors.

[transfer none]

Since: 2.28

### webkit_user_message_send_reply ()

    void
    webkit_user_message_send_reply (WebKitUserMessage *message,
                                    WebKitUserMessage *reply);

Send a reply to `message` . If `reply` is floating, it's consumed. You can only send a reply to a WebKitUserMessage that has been received.

#### Parameters

message | a WebKitUserMessage |
reply | a WebKitUserMessage to send as reply |

Since: 2.28

### webkit_user_message_error_quark ()

    GQuark
    webkit_user_message_error_quark (void);

## Types and Values

### struct WebKitUserMessage

    struct WebKitUserMessage;

### WEBKIT_USER_MESSAGE_ERROR

    #define WEBKIT_USER_MESSAGE_ERROR webkit_user_message_error_quark ()

### enum WebKitUserMessageError

Enum values used to denote errors happening when sending user messages.

#### Members

WEBKIT_USER_MESSAGE_UNHANDLED_MESSAGE | The message was not handled by the receiver. |

Since: 2.28

## Property Details

### The `“fd-list”` property

      “fd-list”                  GUnixFDList *

The UNIX file descriptors of the user message.

Owner: WebKitUserMessage

Flags: Read / Write / Construct Only

Since: 2.28

### The `“name”` property

      “name”                     char *

The name of the user message.

Owner: WebKitUserMessage

Flags: Read / Write / Construct Only

Default value: NULL

Since: 2.28

### The `“parameters”` property

      “parameters”               GVariant *

The parameters of the user message as a GVariant, or `NULL` if the message doesn't include parameters. Note that only complete types are allowed.

Owner: WebKitUserMessage

Flags: Read / Write / Construct Only

Allowed values: GVariant<*>

Default value: NULL

Since: 2.28

## See Also

WebKitWebContext, WebKitWebView, WebKitWebExtension, WebKitWebPage