private void OnWebSocketClose(object s, CloseEventArgs e) { var user = WebSocketPool.FirstOrDefault(q => q.Value.Equals((WebSocket)s)).Key; if (user != null) { WebSocketPool.Remove(user); global.updateCoWorkers(user, false); global.files.SocketClose(user); } }
protected override void OnOpen() { string cookies = Context.Headers.Get("cookie"); user = cookies.Substring(cookies.IndexOf("user") + 5).Split(';')[0]; global.WebSocketSessionsMap.Add(user, ID); global.updateCoWorkers(user, true); foreach (string file in global.files.EditingFiles()) { WatchDogMessage m = new WatchDogMessage(WatchDogMessageType.Lock, global.User, file, global.DropboxBasePath); Send(m.ToString()); } }