Skip to main content
Skip table of contents

Communicator Initialization and Destruction

Creating a Communicator

You create a communicator by using its constructor for example:

TYPESCRIPT
import { Ice } from "@zeroc/ice";

await using communicator = new Ice.Communicator(process.argv);

This constructor accepts the argument vector. It scans the argument vector for any command-line options that are relevant to the Ice runtime; any such options are removed from the argument vector so, when the constructor returns, the only options and arguments remaining are those that concern your application. If anything goes wrong during initialization, it throws an exception.

In a browser application, you should call the constructor without the argument vector.

Communicator implements the asyncDispose method. This allows you to create and cleanup your communicator with await using as shown above.

Initialization Data

When a communicator is created, its constructor or the initialize method configures several features that control its behavior. Once set, these features remain in effect for the lifetime of the communicator and cannot be changed afterward. Therefore, any customization of these features must be done at communicator creation time.

The InitializationData class or struct holds all the features (or options) that you can customize when you create a communicator.

See Also
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.