How can I get a channelId on client platform

kyoku
edited March 2011 in Photon Server
I can use the channelID, when I using the OpCustom from the client platform
.
.
peer.ChannelCount = 5;
.
.
.
this.fiber.Enqueue(() =>this.peer.OpCustom((byte)OperationCode.LoginOperation, parameter, true, (byte)3));
.
.


below list , was when the server received
public void OnOperationRequest(OperationRequest request)
{
    try
    {
        switch (request.ChannelId)
        {
            case (byte)0:
                {
                    break;
                }
            case (byte)3:
                {
                    switch (request.OperationCode)
                    {
                        case (short)OperationCode.LoginOperation:
                            {
                                // do something
                                break;
                            }
                    }
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
}


the server dispatch an EventData to the Client and assign it by a ChannelID
var eventData = new EventData(
                    (short)EventCode.GameEvent,
                    parameter,
                    Reliability.Reliable,
                    3, // use channel 3
                    false);

this.fiber.Enqueue(() => this.photonPeer.SendEvent(eventData));


And the problem is , I can't receive any channelID info from the client.
public void EventAction(byte eventCode, System.Collections.Hashtable photonEvent)
{

    // No channelId parameter
    switch (eventCode)
    {
        case (byte)EventCode.GameEvent:
            {
                break;
            }
    }
}        

Comments

  • Channels are more about organizing messages into separate sequences and giving you a simple way to prioritize them. They are not the same as channels in a MMO where you create a channel per interest group (world, close-by, guild, etc)...
    We didn't think about it as something you actively wanted to know and use on the receiving end.


    It could be added but so far, I thought it's not q requirement.
    Would you explain how you want to use it?
  • Thank you for your answer. Because I'm writing a photon's free tutorial in Traditional Chinese to share taiwanese developer, so i want to clarify some of the detail problem. In fact, So far I only use the Channel 0 in my server.
  • You will often only use channel 0, unless you end up with "2 types of priority", which commonly isn't hit unless it gets rather flooded on the bandwidth and you want to lower the priority of chat to keep the action (movement, and whatever else action the users can do) in realtime without bandwidth imposed delay.

    Thats at least my experience and view on the matter


    Technically you should naturally never need it cause if you need it you are running that close to the edge that you might want to expand the capacity as soon as possible, as you otherwise soon end in the position where even "really important stuff" gets lined up ending in a breakdown of the networking on the server due to more messages being queued up than cleared up
  • I got it, thank you very much.