How to implement voice chat using photon server

Options
nanda
edited November 2011 in Photon Server
i am building an ios app for voice communication using photon server. How to transfer a voice data ( NSData) through photon server.
When i tried to send a NSData to other user , Photon server get disconnected with error code 1041.(invalid data sending). Help me to transfer the voice data through photon server.

Comments

  • Kaiserludi
    Options
    Hi.
    NSData does not belong to the datatypes, supported by Photon protocol, as it is iOs/osx specific and does not have a matching equivalent on each supported platform.
    You should send an EGArray of type nByte instead (it will be send as a short, containing the number of elements, a byte, containing the type of elements, bot only included once for the complete array, not a type per element, and then just a byte for every element, so no additional overhead at all in comparison to how a NSData would be sent, if it would be a supported type).
  • Thanks for ur reply.
    Can you able to help me with sample code for converting an nsdata in to Photon protocol supported EGArray as you specified.

    How to send a large NSData of about (817730 length) through photon server. What is the max amount of data can be sent through photon server through a single opRaiseEvent event?
  • Tobias
    Options
    To avoid long gaps, you should send smaller packages while someone is still talking. It's a bit like streaming the voice data.
    The limit for a single OP is 32kB.

    Please refer to the documentation of NSData to find out how to convert it to byte[] (which is the base for EGArray of nByte).
  • Kaiserludi
    Options
    Well, you can just search on the net for ways to convert between NSData and NSArray. As both are widely used paths of Cocoa, there should be enough to find. An EGArray is just an NSArray with the additional functionality of guaranteeing, that all its elements are of the same type.