Multiuser Lingo Dictionary > Multiuser Lingo Dictionary > getNetMessage()

 

getNetMessage()

Syntax

gMultiuserInstance.getNetMessage()

Description

Multiuser Server Lingo function; returns the oldest waiting network message in the Xtra's message queue. The message is then deleted from the Xtra's memory space. These messages queue up internally for each connection, waiting for this function to be called. If no messages are waiting, this function returns an empty message. This function does not check the connection to the server; it only returns messages that are stored in the Xtra's message queue. It should be called from a network message handler.

If the connection has been opened as a text connection, the sender is set to System and the subject is String. The content is a string containing the data from the server. The Xtra returns all the data available, which might not terminate with the end of a text line. The Xtra includes and does not alter end-of-line characters sent by the server (CR or CRLF). If the server sends a zero byte, the Xtra drops the byte and does not pass it to Lingo.

The function's results are in the form of a property list with the following information. Symbols are used to access the list, retrieving an error code, the sender's ID, the subject, and the message contents.

#errorCode

Resulting error code: 0 if there is no error

#recipients

Users or groups the message was sent to

#senderID

String such as "Fred"

#subject

String subject of the message

#content

List of values, depending on the subject

#timeStamp

Server's time code stamp at the point of handling the message


Example

These statements retrieve a message from the queue:

netMsg = gMultiuserInstance.getNetMessage()
errCode = netMsg.errorCode
if (errCode = 0) then
	senderID = netMsg.senderID
	subject = netMsg.subject
	messageList = netMsg.content
	--handle the message 
else
	--do error processing
	alert gMultiuserInstance.getNetErrorString(errCode)
end if

The contents of the retrieved message look like this:

[#errorCode: 0, #recipients: ["@AllUsers"], #senderID: "Fred", #subject: "ExampleSubject", #content: "ExampleContent", #timeStamp: 36437632]

See also

getNetErrorString()