Chat API : send image ?

Options
Hi,

Is it possible to send image in the chats ?

Thanks.

Best regards,

AB

Comments

  • vadim
    Options
    Chat AP allows exchange with any Photon-serializable data including byte arrays (chat messages are objects, not strings).
    It's up to you how to use this data.
  • Hi,

    Thanks for your quick reply!

    Great news !

    And about historic ? How many times do you keep the message in your database ?

    Thanks again !
  • dontonka
    Options
    Hello ababa,

    In my game I'm using standard Photon RPC to transfer image, as a byte array as indicated by vadim, and that is working fine, so it should works the same with the chat API.

    @vadim, is there any limitation regarding the size of the array?

    Don T.
  • Kaiserludi
    Options
    dontonka wrote:
    is there any limitation regarding the size of the array?
    The maximum size for byte arrays is 2GB.
    However this is more of a theoretical limit, because Photon is optimized for small real time messages, not for big file transfers, so you may run into performance issues and other unforeseen problems when trying to send files that are multiple megabytes in size. From my experience TCP works a lot better than UDP when transferring messages with a size of more than 10kb or so through Photon.
  • dontonka
    Options
    From my experience TCP works a lot better than UDP when transferring messages with a size of more than 10kb or so through Photon.
    I think Photon switch automatically to TCP when packet are bigger than ~1200 Bytes correct?

    Don T.
  • vadim
    Options
    I think Photon switch automatically to TCP when packet are bigger than ~1200 Bytes correct?
    Photon can't switch protocol while client is connected to the server. Larger messages are split to multiple UDP packets.
    In my game I'm using standard Photon RPC to transfer image, as a byte array as indicated by vadim, and that is working fine, so it should works the same with the chat API.
    Chat API does not have RPC or RaiseEvent methods. Sending messages is only way to exchange data in Chat API.
    How many times do you keep the message in your database ?
    History size per channel is 50 messages.
    Once all leave the channel the channel is discarded and history is gone.
  • TripleBoris
    Options
    We are using Photon Chat with Unity and the byte array in our message object seems to be limited to some value around 16000 bytes. When we use UDP, we don't get any error but we never receive the messages over a certain limit. When we use TCP, we get an error on the sender side saying: Receiving failed. SocketException: ConnectionReset.

    We are far from the 2GB limit...

    Is there a setting on the chat client we need to set?
  • vadim
    Options
    Hi,

    32000 bytes message works fine for me with TCP. Can you send a repro case which i can run on my side?
    If it will work, maybe this is related to your network configuration somehow.