How to use the ice.Glacier2.RouterPrx 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 / js / Glacier2 / simpleChat / Client.js View on Github external
}

    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)
        {
            await communicator.destroy();
        }
    }
github zeroc-ice / ice-demos / typescript / nodejs / Glacier2 / simpleChat / Client.ts View on Github external
}
    }

    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 / browser / Glacier2 / simpleChat / Client.ts View on Github external
"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)
    {
        //
        // Handle any exceptions that occurred during session creation.
        //
        if(ex instanceof Glacier2.PermissionDeniedException)
        {
            await error("permission denied:\n" + ex.reason);
        }
        else if(ex instanceof Glacier2.CannotCreateSessionException)
        {
github zeroc-ice / ice-demos / typescript / browser / Chat / Client.ts View on Github external
(() =>
{

    const RouterPrx = Glacier2.RouterPrx;
    const ChatRoomCallbackPrx = Chat.ChatRoomCallbackPrx;
    const ChatSessionPrx = Chat.ChatSessionPrx;

    //
    // Chat client state
    //
    enum State{Disconnected, Connecting, Connected}
    const maxMessageSize = 1024;

    let communicator:Ice.Communicator;
    let username:string;
    let state:State;

    //
    // Servant that implements the ChatCallback interface.
    // The message operation just writes the received data