test: 单个会话订阅. 发送和接收

dev/chat
Lei OT 2 years ago
parent 785fdffc56
commit 90fd95d977

@ -2,6 +2,6 @@ import { observer } from 'mobx-react';
import { Card } from 'antd';
const CustomerProfile = observer(({ customer }) => {
return <Card title={customer.name}>{/* other profile details */}</Card>;
return <Card bordered={false} title={customer.name}>{/* other profile details */}</Card>;
});
export default CustomerProfile;

@ -10,14 +10,14 @@ const InputBox = observer(({ onSend }) => {
onSend(v);
setMessage('');
}
}
};
const sendMessage = async () => {
if (message.trim() !== '') {
// const api = new RealTimeAPI('wss://your_rocket_chat_server_url/websocket');
// await api.login('your_username', 'your_password'); // replace with your actual username and password
// await api.sendMessage({ roomId: 'ROOM_ID', msg: message }); // replace 'ROOM_ID' with your actual room id
setMessage('');
}
if (message.trim() !== '') {
// const api = new RealTimeAPI('wss://your_rocket_chat_server_url/websocket');
// await api.login('your_username', 'your_password'); // replace with your actual username and password
// await api.sendMessage({ roomId: 'ROOM_ID', msg: message }); // replace 'ROOM_ID' with your actual room id
setMessage('');
}
};
return (
@ -26,7 +26,7 @@ const InputBox = observer(({ onSend }) => {
<Button type="primary" className="chat-button">
Send
</Button> */}
<Input.Search placeholder='Type message here' enterButton='Send' size='large' onSearch={handleSend} defaultValue={message} />
<Input.Search placeholder='Type message here' enterButton='Send' size='large' onSearch={handleSend} value={message} onChange={(e) => setMessage(e.target.value)} />
</div>
);
});

Loading…
Cancel
Save