Sign In Register

How can we help you today?

Start a new topic

ListTeamChatResponse and TeamMessage inconsistency

TeamMessage does not contain a timestamp for when the message was posted. ListTeamChatResponse does have a timestamp (for each message).


If each message is stored with a timestamp in the backend database then it would be consistent if it was exposed to the client in both of these structures. No?


Hi James,


You could remedy this by placing the following in the Global SendTeamChatMessageRequest Cloud Code


Spark.setScriptData("when", new Date().getTime())

 

Team members would then receive the following message.

{
 "@class": ".TeamChatMessage",
 "chatMessageId": "58236d5023791d04d128223b",
 "fromId": "5668424ce4b0444485fc3b8d",
 "message": "My Test Message",
 "messageId": "58236d5023791d04d128223d",
 "notification": true,
 "ownerId": "5668424ce4b0444485fc3b8d",
 "playerId": "5668424ce4b0444485fc3b8d",
 "scriptData": {
  "when": 1478717008798
 },
 "summary": "TeamChatMessage",
 "teamId": "1234567888999",
 "teamType": "test",
 "who": "match001"
}


The ListTeamChatResponse would contain a matching timestamp. The times may vary slightly depending on what other code you had executing in the message.


{
 "@class": ".ListTeamChatResponse",
 "messages": [
  {
   "fromId": "5668424ce4b0444485fc3b8d",
   "id": "58236d5023791d04d128223b",
   "message": "My Test Message",
   "when": 1478717008798,
"who": "match001" } ] }


It's something we can look at adding as a default behaviour but the above should work for you for now.


Thanks,

Liam

I actually ended up faking it by using DateTime.Now which was accurate enough for what I needed. Just wanted to help improve your service for the future.


Actually a second bug report... GSData.GetDate("when") throws an exception rather than parsing the field as a javascript-format-unix-time.

Login to post a comment