Sending a complex array in operation result

rejwan
edited March 2011 in Photon Server
Hello,
I want to store messages for offline players, and send all offline messages to my user as soon as he logs in.

So right now we have sort of this array on the server side:
Player
{
 ....
 List<Message> MessageQueue;
}

Message
{
  MessageType Type; (enum)
  long ActivatorID;
  string Message;
}

What would be the best way of sending these messages to the client? Obviously I can't just send an array of Messages, so I thought maybe serialize this object into an array of strings, and put all messages in a 2 dimension array - however this solution seems... not so elegant.
string[][] Messages

EDIT: also, I'm even unsure if 2 dimension arrays can be sent in Photon :P

2nd EDIT: Also thought about doing this:
Hashtable[] Messages;
Each hashtable in array is a message.

Anyone got a better solution?

Comments

  • We decided against array of hashtable when we couldn't find a good representation in C on the native platforms. Even though it would be easy for C#, we wanted all client platforms to support what the server sends.

    You can send a hashtable of hashtables. The key for each message would be the number of the message.
  • Thanks Tobias that solved it, thank you.