Architecture/Interface/Chat
From LookingGlass
Home < Architecture < Interface < ChatChat Interface
Chat messages are queued by the viewer and are read via a GET request on the chat request URL. A chat message from the user is entered with a POST.
The chat URL is http://localhost:9144/api/chat.
The format of the GET response is a JSON map which, for each message, gives the time and the parameters for the message. A response could look like:
{
"200912121023344435": {
"Time": "20091212102334435",
"From": "Fred Flintstone",
"Message": "Yaba daba doooo",
"Type": "Shout",
"EntryType": "Normal"
},
"20091212102336216": {
"Time": "20091212102336216",
"From": "Wilma Flintstone",
"Message": "Fred! What will the Rubbles think?",
"Type": "Whisper",
"EntryType": "Normal"
}
}
This would be the response if two people had spoken since the last chat fetch. As you can see this is a map of maps with each of the latter being messages and the time being duplicated in the outer map.
The definitions of the fields are:
| Property | Value description |
|---|---|
| Time | the time the chat message was received in the format YYYYMMDDHHMMSSFFF |
| From | name of who said the message |
| Message | the message text |
| Type | one of "Normal", "Shout", "Whisper", "OwnerSay", "RegionSay", "Debug" |
| EntryType | one of "ChatTypeNormal", "ChatTypeStatusBlue", "ChatTypeStatusDarkBlue", "ChatTypeLindenChat", "ChatTypeObjectChat", "ChatTypeStartupTitle", "ChatTypeError", "ChatTypeAlert", "ChatTypeOwnerSay", "ChatTypeInvisible" |
| Position | Position of the speaker in the format "<X,Y,Z>" |
| OwnerID | if an object speaking, the owner of the object as a UUID |
Sending a chat message is accomplished by POSTing to the chat url a message with the JSON body which looks like:
{
"Message": "Betty, what do you think is going on over there.",
"Channel": "0",
"Type": "Normal"
}
| Property | Value description | |
|---|---|---|
| Message | The text of the message | |
| Channel | the number of the channel speaking on. Zero is general chat. | |
| Type | one of "Normal", "Whisper", "Shout" | ) |