Client Class

A client of a service worker (https://w3c.github.io/ServiceWorker/#client-interface): a window or a worker of its origin.

public class Client

Properties

NameDescription
FrameTypeGets the frame type of the client.
IdGets the id of the client.
LifecycleStateGets whether the document of the client is frozen (https://wicg.github.io/page-lifecycle/#dom-client-lifecyclestate).
TypeGets the type of the client.
UrlGets the creation URL of the client.

FrameType

Clients.cs

Gets the frame type of the client.

public FrameType FrameType { get; }

Gets the id of the client.

public string Id { get; }

LifecycleState

Clients.cs

Gets whether the document of the client is frozen (https://wicg.github.io/page-lifecycle/#dom-client-lifecyclestate).

public ClientLifecycleState LifecycleState { get; }

Gets the type of the client.

public ClientType Type { get; }

Gets the creation URL of the client.

public string Url { get; }

Methods

NameDescription
PostMessage(object?, StructuredSerializeOptions?)Posts a message to the client: it is dispatched at its ServiceWorkerContainer (https://w3c.github.io/ServiceWorker/#dom-client-postmessage-message-options).
PostMessage(object?, IReadOnlyList<object>)Posts a message to the client (https://w3c.github.io/ServiceWorker/#dom-client-postmessage).

PostMessage overloads

PostMessage(object?, StructuredSerializeOptions?)

Clients.cs

Posts a message to the client: it is dispatched at its ServiceWorkerContainer (https://w3c.github.io/ServiceWorker/#dom-client-postmessage-message-options).

public void PostMessage(object? message, StructuredSerializeOptions? options = null)
Parameters
message object?
options StructuredSerializeOptions?
Exceptions
DomException
A DataCloneError when the message cannot be serialized.
See also

PostMessage(object?, IReadOnlyList<object>)

Clients.cs

Posts a message to the client (https://w3c.github.io/ServiceWorker/#dom-client-postmessage).

public void PostMessage(object? message, IReadOnlyList<object> transfer)