
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
react-chat-agent
Advanced tools
React Chat Agent - A production-ready chat provider with WebSocket support
Clean, production-ready React chat component with external session/token management.
npm install react-chat-agent
Then import the ui in your app:
import 'react-chat-agent/ui.css';
import {
ChatProvider,
ChatPanel,
tokenManager,
sessionManager
} from 'react-chat-agent';
function App() {
// 1. Configure token refresh
tokenManager.setRefreshCallback(async (refreshToken) => {
const res = await fetch('/api/token/refresh', {
method: 'POST',
body: JSON.stringify({ refreshToken })
});
return await res.json(); // { accessToken, refreshToken, expiresIn }
});
// 2. Configure session creation
sessionManager.setCreateSessionCallback(async () => {
const res = await fetch('/api/session/create', { method: 'POST' });
return await res.json(); // { sessionId, accessToken, refreshToken, expiresIn }
});
// 3. Initialize tokens
tokenManager.setTokens({
sessionId: 'your-session-id',
accessToken: 'your-token',
refreshToken: 'your-refresh-token',
expiresIn: 900
});
return (
<ChatProvider useWebSocket={false}>
<ChatPanel
onCreateSession={async () => await sessionManager.createSession()}
config={{
chatUrl: 'https://api.example.com/chat',
historyUrl: 'https://api.example.com/history'
}}
/>
</ChatProvider>
);
}
See INTEGRATION_GUIDE.md for complete documentation including:
import {
ChatProvider, // Context provider
ChatPanel, // Main chat component
useChatContext, // Hook to access chat state
tokenManager, // Token lifecycle management
sessionManager, // Session lifecycle management
chatApi, // API client
streamService, // Stream handler
webSocketService // WebSocket client
} from 'react-chat-agent';
examples/App.jsx - Simple SSE exampleexamples/App-with-session.jsx - Complete session management exampleMIT
FAQs
React Chat Agent - A production-ready chat provider with WebSocket support
We found that react-chat-agent demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.