Start on subscribing to messages in channel entity instances

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo
2021-08-18 11:45:29 -06:00
co-authored by Max Brunsfeld Antonio Scandurra
parent 5b599a32b8
commit 541f58e12c
5 changed files with 126 additions and 29 deletions
+5 -1
View File
@@ -2,6 +2,7 @@ use crate::{language::LanguageRegistry, worktree::Worktree};
use anyhow::{anyhow, Context, Result};
use async_tungstenite::tungstenite::http::Request;
use async_tungstenite::tungstenite::{Error as WebSocketError, Message as WebSocketMessage};
use futures::Stream;
use gpui::{AsyncAppContext, ModelHandle, Task, WeakModelHandle};
use lazy_static::lazy_static;
use smol::lock::RwLock;
@@ -29,7 +30,6 @@ pub struct Client {
pub struct ClientState {
connection_id: Option<ConnectionId>,
pub shared_worktrees: HashMap<u64, WeakModelHandle<Worktree>>,
pub channel_list: Option<WeakModelHandle<ChannelList>>,
pub languages: Arc<LanguageRegistry>,
}
@@ -82,6 +82,10 @@ impl Client {
});
}
pub fn subscribe<T: EnvelopedMessage>(&self) -> impl Stream<Item = Arc<TypedEnvelope<T>>> {
self.peer.subscribe()
}
pub async fn log_in_and_connect(
&self,
router: Arc<ForegroundRouter>,