Interface MessageInterface

The MessageInterface is the attachment of the event in the MessageReceived signal.

The MessageInterface describes messages sent to the users by the administrator of the 3djuump infinite architecture. It contains the text of the message, if it is a critical message, a unique id, the start date when the message will be or is applicable, and an end date when the message is no longer valid.

/** 
* Sample to illustrate the use of the messaging system of a DataSessionInterface (MessageInterface).
*/
import { DataSessionInterface, DataSessionInterfaceSignal, MessageInterface, tListenerCallback, InfiniteEvent } from 'generated/documentation/appinfiniteapi';

// the DataSessionInterface has been created previously and is connected
let lDataSession: DataSessionInterface;
// what to do when a message is received
let onMessageReceived : tListenerCallback;
lDataSession.addEventListener(DataSessionInterfaceSignal.MessageReceived, onMessageReceived);

onMessageReceived = (pEvent: InfiniteEvent, _pCallbackData: Object | undefined) : void =>
{
const lMessage : MessageInterface | undefined = pEvent.attachments;
if (!lMessage)
{
// if no message, then do nothing
return;
}
// and output some fancy message, perhaps some fancy GUI handling is better ? :)
console.log('message ' + lMessage.getId() + ' received :"' + lMessage.getMessage() + '"');
console.log('message is valid from ' + lMessage.getStartTime() + ' to ' + lMessage.getEndTime());
}

Please refer to the [DataSessionInterface](DataSessionInterface.html) for more information.
Events

See

DataSessionInterfaceSignal

Hierarchy

  • MessageInterface

Methods

  • Gets the end time of the message.

    Returns

    The time as a Date.

    Returns Date

  • Gets the unique id of the message.

    Returns

    The unique id of the message.

    Returns number

  • Gets the content of the message.

    Returns

    The message content.

    Returns string

  • Gets the start time of the message.

    Returns

    The time as a Date.

    Returns Date

  • Tells if the message is a critical message (i.e. shutdown server for maintenance).

    Returns

    true if it is a critical message.

    Returns boolean