Skip to content

Commit

Permalink
Add path module and update file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
etienne committed Feb 15, 2024
1 parent 063f9b9 commit 9d4d4df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions backend/src/routes/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import { Room } from "../models/room.js";
import { Message } from "../models/messages.js";
import express from "express";
import dotenv from "dotenv";
import path from "path";
import { User } from "../models/user.js";

export const app = express();
app.use(cors());
dotenv.config();

const options = {
key: fs.readFileSync("../cert/kurama.key"),
cert: fs.readFileSync("../cert/kurama.cert"),
key: fs.readFileSync(path.resolve(__dirname, "../cert/kurama.key")),
cert: fs.readFileSync(path.resolve(__dirname, "../cert/kurama.cert")),
};

export const server = https.createServer(options, app);
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/contexts/SocketContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ export default function SocketProvider({
return;
}
if (!socket) {
let socket = socketIO.connect(process.env.NEXT_PUBLIC_BASE_URL!, {
rejectUnauthorized: false, // Ajoutez cette ligne si vous utilisez un certificat SSL auto-signé
let socket = socketIO.connect(process.env.NEXT_PUBLIC_BASE_URL!);
socket.on("connect_error", (error) => {
console.error("Erreur de connexion :", error);
});
socket.on("receive_message", (data: IMessage) => {
setMessages((prev) => {
Expand Down

0 comments on commit 9d4d4df

Please sign in to comment.