Device Monitoring Studio Server - TODO
Download Device Monitoring Studio Server Hide this button

IConnection Interface

This interface is implemented by the connection object. Use it to control the individual client connection.

Declaration

interface IConnection extends ${IDispatch} {
    // Properties
    readonly ${Client64}: boolean;
    readonly ${Id}: number;
    readonly ${ProcessId}: number;
    readonly ${SessionId}: number;
    readonly ${Sessions}: ${ISessionCollection};
    readonly ${Source}: string;
    readonly ${Status}: ConnectionStatus;
    readonly ${UserName}: string;

    // Methods
    ${Drop}(): void;
    ${DropAllSessions}(): void;
    ${SendCustomMessage}(message: string): void;
}
public interface IConnection : ${IDispatch}
{
    // Properties
    bool ${Client64} { get; }
    ulong ${Id} { get; }
    uint ${ProcessId} { get; }
    uint ${SessionId} { get; }
    ${ISessionCollection} ${Sessions} { get; }
    string ${Source} { get; }
    ConnectionStatus ${Status} { get; }
    string ${UserName} { get; }

    // Methods
    void ${Drop}();
    void ${DropAllSessions}();
    void ${SendCustomMessage}(string message);
}
struct IConnection : IDispatch
{
    // Properties
    VARIANT_BOOL ${Client64};  // get 
    unsigned __int64 ${Id};  // get 
    unsigned long ${ProcessId};  // get 
    unsigned long ${SessionId};  // get 
    ${ISessionCollectionPtr#ISessionCollection} ${Sessions};  // get 
    _bstr_t ${Source};  // get 
    ConnectionStatus ${Status};  // get 
    _bstr_t ${UserName};  // get 

    // Methods
    HRESULT ${Drop}();
    HRESULT ${DropAllSessions}();
    HRESULT ${SendCustomMessage}(_bstr_t message);
};

IConnection Properties

Client64

readonly Client64: boolean;
bool Client64 { get; }
VARIANT_BOOL Client64;  // get 

This property holds true if the client is running a 64-bit operating system and false otherwise.

Id

readonly Id: number;
ulong Id { get; }
unsigned __int64 Id;  // get 

This property holds a unique identifier of a connection. This identifier is guaranteed to be unique for this server only.

ProcessId

readonly ProcessId: number;
uint ProcessId { get; }
unsigned long ProcessId;  // get 

This property holds a process id of the user who established a connection.

SessionId

readonly SessionId: number;
uint SessionId { get; }
unsigned long SessionId;  // get 

This property holds a session id of the user who established a connection.

Sessions

readonly Sessions: ${ISessionCollection};
${ISessionCollection} Sessions { get; }
${ISessionCollectionPtr#ISessionCollection} Sessions;  // get 

Returns a collection of all connected sessions.

Source

readonly Source: string;
string Source { get; }
_bstr_t Source;  // get 

This property returns the computer name a connection originates from.

Status

readonly Status: ConnectionStatus;
ConnectionStatus Status { get; }
ConnectionStatus Status;  // get 

Returns a connection status. One of the following values is returned:

StatusValueDescription
ClientDisconnected0Client has already been disconnected and connection is closed. Connections are never re-used.
ClientConnected1Client is connected.

UserName

readonly UserName: string;
string UserName { get; }
_bstr_t UserName;  // get 

This property holds a user name of the user that established a connection.

IConnection Methods

Drop

Drop(): void;
void Drop();
HRESULT Drop();

Drops the current connection and all its monitoring sessions.

DropAllSessions

DropAllSessions(): void;
void DropAllSessions();
HRESULT DropAllSessions();

Forcibly closes all active monitoring sessions for this connection.

SendCustomMessage

SendCustomMessage(message: string): void;
void SendCustomMessage(string message);
HRESULT SendCustomMessage(_bstr_t message);
message
A text message to send.

This method sends a supplied text message to the client. A client will see this message in a pop-up window. An administrator may use this method to warn clients of the forthcoming server shutdown or session drop, for example.

Warning the user of the forthcoming shutdown.

$conn.SendCustomMessage('Prepare for disconnect. We are about to restart a server.')