How to use the ice.Ice.initialize function in ice

To help you get started, we’ve selected a few ice examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeroc-ice / ice-demos / typescript / nodejs / Glacier2 / simpleChat / Client.ts View on Github external
await session.say(message);
            }
        }
    }

    let communicator:Ice.Communicator;
    try
    {
        //
        // Initialize the communicator with Ice.Default.Router property
        // set to the simple chat demo Glacier2 router.
        //
        const initData = new Ice.InitializationData();
        initData.properties = Ice.createProperties();
        initData.properties.setProperty("Ice.Default.Router", "DemoGlacier2/router:tcp -p 4063 -h localhost");
        communicator = Ice.initialize(process.argv, initData);

        const router = await Glacier2.RouterPrx.checkedCast(communicator.getDefaultRouter());
        const session = await createSession(router);
        await runWithSession(router, session);
    }
    catch(ex)
    {
        console.log(ex.toString());
        process.exitCode = 1;
    }
    finally
    {
        if(communicator)
        {
            await communicator.destroy();
        }
github zeroc-ice / ice-demos / typescript / nodejs / Manual / simpleFilesystem / Client.ts View on Github external
else
            {
                const file = Filesystem.FilePrx.uncheckedCast(node);
                const text = await file.read();
                for(const line of text)
                {
                    console.log(`${indent}\t${line}`);
                }
            }
        }
    }

    let communicator:Ice.Communicator;
    try
    {
        communicator = Ice.initialize(process.argv);
        if(process.argv.length > 2)
        {
            throw new Error("too many arguments");
        }

        //
        // Create a proxy for the root directory
        //
        const base = communicator.stringToProxy("RootDir:default -h localhost -p 10000");

        //
        // Down-cast the proxy to a directory proxy
        //
        const rootDir = await Filesystem.DirectoryPrx.checkedCast(base);
        if(!rootDir)
        {
github zeroc-ice / ice-demos / js / Ice / minimal / Client.js View on Github external
(async function()
{
    let communicator;
    try
    {
        communicator = Ice.initialize(process.argv);
        //
        // Down-cast the proxy to the hello object interface and invoke
        // the sayHello method.
        //
        const hello = await Demo.HelloPrx.checkedCast(communicator.stringToProxy("hello:tcp -h localhost -p 10000"));
        await hello.sayHello();
    }
    catch(ex)
    {
        console.log(ex.toString());
        process.exitCode  = 1;
    }
    finally
    {
        if(communicator)
        {
github zeroc-ice / ice-demos / typescript / nodejs / Ice / minimal / Client.ts View on Github external
(async () =>
{
    let communicator:Ice.Communicator;
    try
    {
        communicator = Ice.initialize(process.argv);
        //
        // Down-cast the proxy to the hello object interface and invoke
        // the sayHello method.
        //
        const hello = await Demo.HelloPrx.checkedCast(communicator.stringToProxy("hello:tcp -h localhost -p 10000"));
        await hello.sayHello();
    }
    catch(ex)
    {
        console.log(ex.toString());
        process.exitCode = 1;
    }
    finally
    {
        if(communicator)
        {
github zeroc-ice / ice-demos / typescript / browser / Chat / Client.ts View on Github external
{
                routerConfig = data['Ice.Default.Router'];
            }
            else
            {
                throw new Error('Ice.Default.Router not in config file');
            }

            //
            // Initialize the communicator with the Ice.Default.Router property
            // provided by 'config.json'
            //
            const initData = new Ice.InitializationData();
            initData.properties = Ice.createProperties();
            initData.properties.setProperty("Ice.Default.Router", routerConfig);
            communicator = Ice.initialize(initData);

            //
            // Get a proxy to the Glacier2 router using checkedCast to ensure
            // the Glacier2 server is available.
            //
            const router = await RouterPrx.checkedCast(communicator.getDefaultRouter());

            //
            // Create a session with the Glacier2 router.
            //
            const username = $("#username").val() as string;
            const password = $("#password").val() as string;
            const session = await router.createSession(username, password);
            await run(router, ChatSessionPrx.uncheckedCast(session));
        }
        catch(ex)
github zeroc-ice / ice-demos / typescript / browser / Ice / throughput / Client.ts View on Github external
stringSeq[i] = "hello";
}

const structSeq:Demo.StringDoubleSeq = [];
for(let i = 0; i < Demo.StringDoubleSeqSize; ++i)
{
    structSeq[i] = new Demo.StringDouble("hello", 3.14);
}

const fixedSeq:Demo.FixedSeq = [];
for(let i = 0; i < Demo.FixedSeqSize; ++i)
{
    fixedSeq[i] = new Demo.Fixed(0, 0, 0);
}

const communicator = Ice.initialize();

//
// Handle the client state.
//
enum State
{
    Idle,
    Running
};

let state:State;

//
// Run the throughput test.
//
async function run()
github zeroc-ice / ice-demos / typescript / browser / Ice / latency / Client.ts View on Github external
(() =>
{

//
// Handle the client state.
//
enum State
{
    Idle,
    Running
}

//
// Initialize the communicator
//
const communicator = Ice.initialize();

//
// Run the latency test.
//
async function run()
{
    const hostname = document.location.hostname || "127.0.0.1";
    const secure = document.location.protocol.indexOf("https") != -1;
    const ref = secure ?
          `ping:wss -h ${hostname} -p 9090 -r /demowss` :
          `ping:ws -h ${hostname} -p 8080 -r /demows`;

    const repetitions = 1000;

    //
    // Create a proxy to the ping object and down-cast the proxy
github zeroc-ice / ice-demos / js / Manual / printer / Client.js View on Github external
(async () =>
{
    let communicator;
    try
    {
        communicator = Ice.initialize();
        const base = communicator.stringToProxy("SimplePrinter:default -p 10000");
        const printer = await Demo.PrinterPrx.checkedCast(base);
        if(printer)
        {
            await printer.printString("Hello World!");
        }
        else
        {
            console.log("Invalid proxy");
        }
    }
    catch(ex)
    {
        console.log(ex.toString());
        process.exitCode = 1;
    }
github zeroc-ice / ice-demos / typescript / nodejs / Ice / hello / Client.ts View on Github external
(async () =>
{
    let communicator:Ice.Communicator;
    try
    {
        communicator = Ice.initialize(process.argv);

        if(process.argv.length > 2)
        {
            throw new Error("too many arguments");
        }

        const proxy = communicator.stringToProxy("hello:default -p 10000").ice_twoway().ice_secure(false);
        let timeout = -1;
        let delay = 0;

        let twoway = await Demo.HelloPrx.checkedCast(proxy);
        let oneway = twoway.ice_oneway();
        let batchOneway = twoway.ice_batchOneway();

        menu();
        let line = null;
github zeroc-ice / ice-demos / js / Ice / hello / Client.js View on Github external
(async function()
{
    let communicator;
    try
    {
        communicator = Ice.initialize(process.argv);

        if(process.argv.length > 2)
        {
            throw new Error("too many arguments");
        }

        let proxy = communicator.stringToProxy("hello:default -p 10000").ice_twoway().ice_secure(false);
        let timeout = -1;
        let delay = 0;

        let twoway = await Demo.HelloPrx.checkedCast(proxy);
        let oneway = twoway.ice_oneway();
        let batchOneway = twoway.ice_batchOneway();

        menu();
        let line = null;