= PEEK MESSAGE( portId )
The PEEK MESSAGE
function can be used to wait for a message on a DOJO port.
The function returns FALSE
if the the message port is empty. On the contrary,
if it returns TRUE
, it is possible to fetch the message using the
GET MESSAGE
command.
Note that the message port behaves like a queue, that is, the first message that is inserted is the first that is retrieved. Therefore, if a program sends three messages in a row to the attention of the port of another, the receiving program will receive the three messages in the same order. Obviously, if several programs do the same thing, the messages will be interspersed but, in the end, they will be in the same order.
sessionId = LOGIN( "user", "password" ) port = FIND( sessionId, "user2", "testApp" ) IF PEEK MESSAGE( port ) THEN PRINT "A message is arrived!" ENDIF
PkMsg
If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!