mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-24 11:16:12 +01:00
✨ feat: Add WebSocket functionality and integrate call features in the chat component
This commit is contained in:
parent
ea5cb4bc2b
commit
cf4b73b5e3
21 changed files with 588 additions and 142 deletions
18
api/server/routes/websocket.js
Normal file
18
api/server/routes/websocket.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
const express = require('express');
|
||||
const optionalJwtAuth = require('~/server/middleware/optionalJwtAuth');
|
||||
const router = express.Router();
|
||||
|
||||
router.get('/', optionalJwtAuth, async (req, res) => {
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const useSSL = isProduction && process.env.SERVER_DOMAIN?.startsWith('https');
|
||||
|
||||
const protocol = useSSL ? 'wss' : 'ws';
|
||||
const serverDomain = process.env.SERVER_DOMAIN
|
||||
? process.env.SERVER_DOMAIN.replace(/^https?:\/\//, '')
|
||||
: req.headers.host;
|
||||
const wsUrl = `${protocol}://${serverDomain}/ws`;
|
||||
|
||||
res.json({ url: wsUrl });
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
Loading…
Add table
Add a link
Reference in a new issue