diff --git a/examples/experimental/nodes/frontend/src/App.tsx b/examples/experimental/nodes/frontend/src/App.tsx index c8feec3a..61f84e2a 100644 --- a/examples/experimental/nodes/frontend/src/App.tsx +++ b/examples/experimental/nodes/frontend/src/App.tsx @@ -138,7 +138,7 @@ const App: React.FC = () => {
- +
); diff --git a/examples/experimental/nodes/frontend/src/components/ChatInterface/ChatInterface.tsx b/examples/experimental/nodes/frontend/src/components/ChatInterface/ChatInterface.tsx index 6c95d719..6e4601f4 100644 --- a/examples/experimental/nodes/frontend/src/components/ChatInterface/ChatInterface.tsx +++ b/examples/experimental/nodes/frontend/src/components/ChatInterface/ChatInterface.tsx @@ -1,5 +1,7 @@ import './ChatInterface.css'; import React, { ReactNode, useState } from 'react'; +import { Socket } from 'socket.io-client'; // Import the Socket type + interface ScrollAreaProps { className?: string; @@ -25,9 +27,10 @@ interface ChatInterfaceProps { text: string; type: 'message' | 'status'; }>; + socket: Socket; } -export const ChatInterface: React.FC = ({ messages: initialMessages }) => { +export const ChatInterface: React.FC = ({ messages: initialMessages , socket}) => { const [messages, setMessages] = useState(initialMessages); const [input, setInput] = useState(''); const messagesEndRef = React.useRef(null); @@ -53,6 +56,7 @@ export const ChatInterface: React.FC = ({ messages: initialM text: `User: ${input}`, // Prefix with "User:" type: 'message' }]); + socket.emit('chat_message', `User: ${input}`); // Emit the command to the server setInput(''); } };