Rex's plugins for Construct2
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About

rex_parse_message

Plugin, ACE table, Discussion thread
Dependence:
rex_parse_initialize

Introduction
Send/receive messages.

Usage

Message board - set domain URL of firebase service (for rex_firebase_simplemessage object) and api key & javascript key of parse service first.
Prepare
Add 
rex_parse_initialize to set api id and javascript key.
Class name
"Class name" in properties table is the "table name" shown at dash board.


Send message
Call "
Action:Set user" to set the senderID and sender name, then call "Action:Send" to send a message to receverID.

A message contains
  • Title: title (i.e. header) of the message.
  • Content: content (i.e. body) of the message.
  • Category: to classify messages, like "system".
  • Status: status of this message, like "unread".
  • SenderID, SenderName: ID and name of sender.
  • ReceiverID: ID of receiver.
  • messageID: an unique ID of this message, auto generated by parse server while saved.
  • createAt: timestamp of created this message, auto generated by parse server while saved.
  • Mark: array of some unique data, like read userID.
"Condition:On send complete" will be triggered when sending success, get sent messageID by "Expression:LastSentMessageID".
Otherwise "Condition: On send error" will be triggered.
SenderID and sender name could be read back by "
Expression:MyUserID", "Expression:MyUserName".
Change status
Call "
Action:Set status" to change status of message by messageID.
"Condition:On set status complete" will be triggered while changing success, otherwise "Condition:On set status error" will be triggered.
Append mark
Call "Action:Append mark" to append a mark. "Condition:On append mark complete" will be triggered while changing success, otherwise "Condition:On append mark error" will be triggered.
User could append userID to mark the message to be read, for example.

Receive messages
There are some ways to receive messages,
  • using message filter to get matched messages, or
  • using messageID to get specific message.
Fetch by message filter
There are 6 kinds of filter for messages:
  • senderID,
  • receiverID,
  • category,
  • status,
  • created/update time
  • mark
Follows these 5 steps to create a message filter:
  1. New filter : call "Action:1. New" to build a new message filter.
  2. SenderID : call "Action:2. add sender" to add a senderID into filter. It will use OR operation to joint these added senderIDs. Or call "Action:2. all senders" to accept all senderID. Ignoring this step is equal to "Action:2. all senders".
  3. ReceiverID: call "Action:3. add receiver" to add a receiverID into filter. It will use OR operation to joint these added receiverIDs. Or call "Action:3. all receivers" to accept all receiverID. Ignoring this step is equal to "Action:3. all receivers".
  4. Category: call "Action:4. add category" to add a category into filter. It will use OR operation to joint these added categories. Or call "Action:4. all categories" to accept all categories. Ignoring this step is equal to "Action:4. all categories".
  5. Status: call "Action:5. add status" to add a status into filter. It will use OR operation to joint these added status. Or call "Action:4. all status" to accept all status. Ignoring this step is equal to "Action:4. all stauts".
  6. Timestamp: call "Action:6. add timestamp constraint" to add a time constraint. It will use AND operation to joint these time constraint. Or call "Action:6. all timestamps" to ignore time constraint. The input parameter "Timestamp" could be created by "Expression:Date2UnixTimestamp" in rex_date plugin. Ignoring this step is equal to "Action:6. all timestamp.
  7. Mark: call "Action:Set mark constraint" to set mark constraint, to pick messages which has this mark or does not have.
Fetching messages
After build a new message filter by these steps
, call one of request actions to start fetching -

Pages
  • Action:Request to page
  • Action:Request current page
  • Action:Request next page
  • Action:Request previous page
Ordered messages would be divided into pages, which started from page 0 (0-based). Lines of each page is set at "Lines" in properties table.
The order of messages is set at "
Order" in
properties table,
"Earlier to later", or "Later to earlier".
Get message count of current page by "Expression:CurMessageCount". "Condition:Last page" will return true if current page is the last page, which the message count is less than requested count.
Start from any index
Or call "Action:Request in a range" to fetch ordered messages started from any index.
Do not mix this action with pages type requests described at previous section.
All messages
Or call "Action:Request all messages" to fetch all ordered messages .
Do not mix this action with pages type requests described at previous section.
Receive content
Content of each message could be got together if the "
Content" parameter set to "with" in each request action. Designer might request a content of a specific message by messageID later.
Retrieve messages
"
Condition:On received" will be triggered when received requested messages. Then use "Condition:For each message" or "Condition:For each message in a range" to retrieve these messages by these expressions.
  • Expression:CurMessageIndex, which is 0-based
  • Expression:CurSenderID
  • Expression:CurSenderName
  • Expression:CurReceiverID
  • Expression:CurTitle
  • Expression:CurStatus
  • Expression:CurContent , if set the "Content" parameter to "with"
  • Expression:CurMessageID
  • Expression:CurSentAt

Fetch by messageID
Call "
Action:Load by messageID" to fetch whole message with content by messageID.
"
Condition:On load by messageID complete" will be triggered when fetching success, otherwise "Condition:On load by messageID error" will be triggered. Get message fields by these expressions-
  • Expression:LastFetchedSenderID
  • Expression:LastFetchedSenderName
  • Expression:LastFetchedReceiverID
  • Expression:LastFetchedTitle
  • Expression:LastFetchedContent
  • Expression:LastFetchedStatus
  • Expression:LastFetchedMessageID
  • Expression:LastFetchedSentAt

Remove messages
There are two ways to remove messages -
  • by messageID,
  • by message filter.
Remove by messageID
Call "
Action:Remove by messageID" to remove a message by messageID.
"
Condition:On remove by messageID complete" will be triggered when removing success. Get removed messageID by "Expression:LastRemovedMessageID".
Otherwise "
Condition:On remove by messageID error" will be triggered.
Remove by message filter
It also supports removing messages picked by message filter.
First creating a new message filter described at previous section, then call "
Action:Remove queried
messages" to remove them.
"
Condition:On remove queried messages complete" will be triggered when all messages removed success, otherwise "Condition:On remove queried messages error" will be triggered.

Message count
Get filtered message count by "
Action:Get messages count" after
build a new message filter. The result is put at "
Expression:LastMessagesCount" under "Condition:On get messages count complete", otherwise "Condition:On get messages count error" if requesting failed.

Send function call
Designer could create a function call string by
rex_fncallpkg plugin's "Expression:FnCallPkg", then put at title or content field to send. To run this function string, put this string in rex_fncallpkg plugin's "Action:Call function".

It is a kind of RPC, since it could transfer message into function call directly,

Create a free web site with Weebly
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About