How to use the ice.Ice.InitializationData 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
}
            else
            {
                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)
github zeroc-ice / ice-demos / js / Glacier2 / simpleChat / Client.js View on Github external
else
            {
                await session.say(message);
            }
        }
    }

    let communicator;
    let completed = false;
    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)
github zeroc-ice / ice-demos / typescript / browser / Chat / Client.ts View on Github external
const data = await $.getJSON('config.json');
            if('Ice.Default.Router' in data)
            {
                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);
github zeroc-ice / ice-demos / typescript / browser / Glacier2 / simpleChat / Client.ts View on Github external
// use a non-secure (WS) endpoint.
        //
        // The web server will act as a reverse proxy for WebSocket connections. This
        // facilitates the setup of WSS with self-signed certificates because Firefox
        // and Internet Explorer certificate exceptions are only valid for the same
        // port and host.
        //
        const secure = document.location.protocol.indexOf("https") != -1;
        const proxy = secure ? "DemoGlacier2/router:wss -p 9090 -h " + hostname + " -r /chatwss" :
                "DemoGlacier2/router:ws -p 8080 -h " + hostname + " -r /chatws";

        //
        // Initialize the communicator with the 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", proxy);
        communicator = Ice.initialize(initData);

        //
        // Get a proxy to the Glacier2 router using checkedCast to ensure
        // the Glacier2 server is available.
        //
        const router = await Glacier2.RouterPrx.checkedCast(communicator.getDefaultRouter());
        const username = $("#username").val() as string;
        const password = $("#password").val() as string;
        const session = await router.createSession(username, password);
        await runWithSession(router, Demo.ChatSessionPrx.uncheckedCast(session));
    }
    catch(ex)
    {