/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using SafeExamBrowser.Communication.Contracts.Events;
namespace SafeExamBrowser.Communication.Contracts
{
///
/// Defines the common functionality for all communication proxies. A proxy is needed to be able to perform inter-process communication
/// with the of another application component.
///
public interface ICommunicationProxy
{
///
/// Indicates whether a connection to the host has been established.
///
bool IsConnected { get; }
///
/// Fired when the connection to the host was lost, e.g. if a ping request failed or a communication fault occurred.
///
event CommunicationEventHandler ConnectionLost;
///
/// Tries to establish a connection. Returns true if the connection has been successful, otherwise false. If a
/// connection was successfully established and the auto-ping flag is set, the connection status will be periodically checked.
///
bool Connect(Guid? token = null, bool autoPing = true);
///
/// Terminates an open connection. Returns true if the disconnection has been successful, otherwise false.
///
bool Disconnect();
}
}