コード例 #1
0
ファイル: WSClientAdapter.cs プロジェクト: zhouzu/Bumblebee
        public virtual void Init(UrlRouteAgent urlRouteAgent)
        {
            var urlRoute = GetRouteAgent(Gateway, Request, urlRouteAgent);
            var server   = urlRoute.GetServerAgent(Request);

            WSClient                     = server.Agent.GetWSClient();
            WSClient.DataReceive        += OnReceive;
            WSClient.Method              = Request.Method;
            WSClient.Path                = Request.Url;
            WSClient.Origin              = Request.Header["Origin"];
            WSClient.Host                = Request.Header["Host"];
            WSClient.SecWebSocketKey     = Request.Header["Sec-WebSocket-Key"];
            WSClient.SecWebSocketVersion = Request.Header["Sec-WebSocket-Version"];
            var headers = Request.Header.Copy();

            foreach (var item in headers)
            {
                if (!mDefaultHeader.TryGetValue(item.Key, out string value))
                {
                    WSClient.Headers.Add(item.Key, item.Value);
                }
            }
        }
コード例 #2
0
 public void Dispose()
 {
     WSClient = null;
 }