How to use the ice.Ice.Identity 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
//
        // Use ACM heartbeat to keep session alive.
        //
        const connection = router.ice_getCachedConnection();
        if(timeout > 0)
        {
            connection.setACM(timeout, undefined, Ice.ACMHeartbeat.HeartbeatAlways);
        }

        connection.setCloseCallback(() => console.log("Connection lost"));

        //
        // Create the ChatCallback servant and add it to the ObjectAdapter.
        //
        const callback = Demo.ChatCallbackPrx.uncheckedCast(
            adapter.add(new ChatCallbackI(), new Ice.Identity("callback", category)));

        //
        // Set the chat session callback.
        //
        await session.setCallback(callback);

        //
        // The chat function sequantially reads stdin messages
        // and send it to server using the session say method.
        //
        while(true)
        {
            process.stdout.write("==> ");
            const message = await getline();

            if(message == "/quit")
github zeroc-ice / ice-demos / typescript / nodejs / Glacier2 / simpleChat / Client.ts View on Github external
//
        // Use ACM heartbeat to keep session alive.
        //
        const connection = router.ice_getCachedConnection();
        if(timeout > 0)
        {
            connection.setACM(timeout, undefined, Ice.ACMHeartbeat.HeartbeatAlways);
        }

        connection.setCloseCallback(() => console.log("Connection lost"));

        //
        // Create the ChatCallback servant and add it to the ObjectAdapter.
        //
        const callback = Demo.ChatCallbackPrx.uncheckedCast(
            adapter.add(new ChatCallbackI(), new Ice.Identity("callback", category)));

        //
        // Set the chat session callback.
        //
        await session.setCallback(callback);

        //
        // The chat function sequentially reads stdin messages and
        // sends them to the server using the session say method.
        //
        while(true)
        {
            process.stdout.write("==> ");
            const message = await getline();

            if(message == "/quit")
github zeroc-ice / ice-demos / typescript / browser / Chat / Client.ts View on Github external
//
            // Use ACM heartbeat to keep session alive.
            //
            const connection = router.ice_getCachedConnection();
            if(timeout > 0)
            {
                connection.setACM(timeout, undefined, Ice.ACMHeartbeat.HeartbeatAlways);
            }

            //
            // Create the ChatCallback servant and add it to the
            // ObjectAdapter.
            //
            const callback = ChatRoomCallbackPrx.uncheckedCast(adapter.add(new ChatCallbackI(),
                                                                           new Ice.Identity("callback", category)));

            //
            // Set the chat session callback.
            //
            await session.setCallback(callback);

            await setState(State.Connected);

            //
            // Process input events in the input textbox until completed.
            //
            await new Promise(
                (resolve, reject) =>
                    {
                        $("#input").keypress(
                            e =>
github zeroc-ice / ice-demos / typescript / browser / Glacier2 / simpleChat / Client.ts View on Github external
//
        // Use ACM heartbeat to keep session alive.
        //
        const connection = router.ice_getCachedConnection();
        if(timeout > 0)
        {
            connection.setACM(timeout, undefined, Ice.ACMHeartbeat.HeartbeatAlways);
        }

        connection.setCloseCallback(() => error("Connection lost"));

        //
        // Create the ChatCallback servant and add it to the ObjectAdapter.
        //
        const callback = Demo.ChatCallbackPrx.uncheckedCast(
            adapter.add(new ChatCallbackI(), new Ice.Identity("callback", category)));

        //
        // Set the chat session callback.
        //
        await session.setCallback(callback);

        //
        // Stop animating the loading progress bar and transition to the chat screen.
        //
        stopProgress(true);
        await transition("#loading", "#chat-form");

        $("#loading .meter").css("width", "0%");
        state = State.Connected;
        $("#input").focus();