Exemplo n.º 1
0
        internal WebSocketClient(WebSocket socket, WebSession session)
        {
            if (session != null)
            {
                session.Owner = this;
            }

            this.socket = socket;
            Session     = session;
        }
Exemplo n.º 2
0
        public static void SaveWebSession(this ISession session, WebSession value)
        {
            byte[] data = null;
            using (var ms = new MemoryStream())
            {
                var bs = new BinSerializer(ms); //TODO:使用ThreadCache或参照RoutedSesseionWriter
                bs.Write(value.SessionID);
                bs.Serialize(value.TreeNodePath);
                bs.Write(value.IsExternal);
                if (!value.IsExternal)
                {
                    bs.Write(value.EmploeeID);
                }
                bs.Write(value.Tag);
                bs.Clear();
                data = ms.ToArray();
            }

            session.Set(WebSession.UserSessionKey, data);
        }