e2ee-chat
Version:
A simple realtime chat SDK for web and mobile apps using socket.io with support for end-to-end encryption and multi-tenant backend integration.
19 lines (15 loc) • 489 B
JavaScript
const axios = require("axios");
async function fetchHistory(serverUrl, roomId, apiKey) {
const url = `${serverUrl}/messages/${roomId}?apiKey=${apiKey}`;
const response = await axios.get(url); // 👈 No headers needed
return response.data;
}
async function createOrGetChatSession(serverUrl, data) {
const url = `${serverUrl}/chat-session`;
const response = await axios.post(url, data);
return response.data;
}
module.exports = {
fetchHistory,
createOrGetChatSession,
};