Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//
// 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);
//
// 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);
//
// 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);
//
// 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);
//