How to use the ice.Ice.ACMHeartbeat 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
//
        // Get the session timeout, the router client category and
        // create the client object adapter. Using Promise.all we
        // can wait for the completion of all the calls at once.
        //
        let [timeout, category, adapter] = await Promise.all([router.getACMTimeout(),
                                                              router.getCategoryForClient(),
                                                              router.ice_getCommunicator().createObjectAdapterWithRouter("", router)]);

        //
        // 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);

        //
github zeroc-ice / ice-demos / typescript / nodejs / Glacier2 / simpleChat / Client.ts View on Github external
// can wait for the completion of all the calls at once.
        //
        const [timeout, category, adapter] = await Promise.all(
            [
                router.getACMTimeout(),
                router.getCategoryForClient(),
                router.ice_getCommunicator().createObjectAdapterWithRouter("", router)
            ]);

        //
        // 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);

        //
github zeroc-ice / ice-demos / typescript / browser / Chat / Client.ts View on Github external
// calls.
            //
            const [timeout, category, adapter] = await Promise.all(
                [
                    router.getACMTimeout(),
                    router.getCategoryForClient(),
                    communicator.createObjectAdapterWithRouter("", router)
                ]);

            //
            // 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);
github zeroc-ice / ice-demos / typescript / browser / Glacier2 / simpleChat / Client.ts View on Github external
//
        // Use Promise.all to wait for the completion of all the calls.
        //
        const [timeout, category, adapter] = await Promise.all(
            [
                router.getACMTimeout(),
                router.getCategoryForClient(),
                router.ice_getCommunicator().createObjectAdapterWithRouter("", router)
            ]);
        //
        // 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);

        //