Retrieve user's Nickname and Data in Photon Chat JavaScript/TypeScript SDK

When I receive message object in Photon Chat JS SDK it only has sender ID and actual content. Where can I get Nickname and Data fields of the user who sent this message? Thank you.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited December 2019
    Hi @rjkz808,

    Unlike Photon Realtime (PUN, Photon Voice), Photon Chat does not have Nickname.
    What "Data" field are you referring to? the one sent back in custom authentication?
    That's probably not implemented or not exposed in the Photon Chat JavaScript SDK if not all Photon Chat SDKs.
    How urgent is this?
  • Hi! I need some custom properties to be stored for each user. For example, user's level in game. And I also need to update this properties. If user has just raised its level, it would be confusing that old messages are shown with the old level to other persons. How can I make this work within Photon Chat?

  • rjkz808
    rjkz808
    edited December 2019

    I also want to mention one thing - for now I just send some additional metadata as JSON string in the message content. Can this approach be considered correct for Photon Chat SDK?

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @rjkz808,

    How can I make this work within Photon Chat?

    Can this approach be considered correct for Photon Chat SDK?

    You actually use the approach we suggest usually.

    Photon Chat allows you to exchange anything serializable/supported by Photon.

    So this approach is OK.

    Another trick you could use to optimize and improve this:

    Chat's online status feature allows a user to broadcast a custom message to all other users who have added him as a friend via AddFriends. This custom message could include the user's properties and other things. This could save some extra messages in chat channels. More information here.