Esempio n. 1
0
 /// <summary>
 /// 设置消息处理函数管道
 /// </summary>
 /// <param name="handle"></param>
 internal void SetHandle(WebSocket_Handle handle)
 {
     if (handle == null)
     {
         return;
     }
     WebsocketHandle = handle;
 }
Esempio n. 2
0
        /// <summary>
        ///  初始化一个新的 <see cref="WebSocketSession"/> 实例
        /// </summary>
        /// <param name="acceptSocket">监听器完成连接的基础通讯连接</param>
        /// <param name="webSocketServer">表示当前连接所属的连接服务监听器</param>
        public WebSocketSession(IPipelineSocket acceptSocket, WebSocketServer webSocketServer)
        {
            //初始化当前连接的监听器
            _webSocketServer = webSocketServer;

            //实例化为一个基础的消息解析函数器
            WebsocketHandle = new WebSocket_Handle(this);
            AcceptSocket    = acceptSocket;
            //通知事件的绑定
            AcceptSocket.ReceiveCompleted = AcceptSocket_ReceiveCompleted;
            AcceptSocket.Disposed         = AcceptSocket_Disposed;
            //启动数据接收
            AcceptSocket.StartReceive();
        }