Esempio n. 1
0
 public WebSocketServer(ChannelGroupSettings channelsettings = null)
 {
     if (channelsettings == null)
     {
         GroupSettings = new ChannelGroupSettings();
     }
     else
     {
         GroupSettings = channelsettings;
     }
 }
Esempio n. 2
0
        public Connection(ChannelGroupSettings info)
        {
            Channels        = new Dictionary <string, Channel>();
            ChannelByNumber = new Dictionary <int, Channel>();

            if (info.Channels.Count < 1)
            {
                throw new Exception("You cannot have less than 1 channel in a Connection");
            }
            if (info.Channels.Count > 16)
            {
                throw new Exception("You cannot have more than 16 channels in a Connection");
            }

            ClearBuffer();

            foreach (var c in info.Channels)
            {
                Channel ch = new Channel(c);
                ch.MessageComplete += new MessageEventHandler(this.OnChannelMessage); // attach each channel to the event handler
                Channels[c.Name]    = ch;
                ChannelByNumber[c.ChannelNumber] = ch;
            }
        }