public ChatView(ChatSocket chatSocket) { _chatSocket = chatSocket; _chatUnit = new ChatUIUnit(); _chator = new Chator() { ChatorId = Guid.NewGuid().ToString(), ChatorName = Utils.GenRandomName() }; _receivedMessageBox = new Subject <ChatMessageModel>(); _sendMessageBox = new Subject <ChatMessageModel>(); // 消息监听 Subscribe(); _chatSocket.Connect(); // 开启socket接收消息 _chatSocket.ListenReceiveMessageOnTask(OnReceiveMessage); GoChatRoom(); }