Fixed https
This commit is contained in:
parent
79fafa466b
commit
7ea764730b
@ -1,9 +1,23 @@
|
|||||||
const express = require("express");
|
const fs = require('fs');
|
||||||
|
const https = require('https');
|
||||||
|
const express = require('express');
|
||||||
|
const socketio = require('socket.io');
|
||||||
const app = express();
|
const app = express();
|
||||||
const http = require("http");
|
|
||||||
const server = http.createServer(app);
|
const https_options = {
|
||||||
const io = require("socket.io")(server);
|
key: fs.readFileSync('./privkey.pem'),
|
||||||
|
cert: fs.readFileSync('./fullchain.pem'),
|
||||||
|
requestCert: false,
|
||||||
|
rejectUnauthorized: false
|
||||||
|
}
|
||||||
|
const server = https.createServer(https_options, app);
|
||||||
|
|
||||||
|
const io = socketio(server, {
|
||||||
|
cors: {
|
||||||
|
origin: "https://danby.aniere.fr",
|
||||||
|
},
|
||||||
|
secure: true
|
||||||
|
});
|
||||||
|
|
||||||
usersConnected = 0
|
usersConnected = 0
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
<div id="counter-container">
|
<div id="counter-container">
|
||||||
<span>Nombre de fans connectés : <span id="value">x</span></span>
|
<span>Nombre de fans connectés : <span id="value">x</span></span>
|
||||||
</div>
|
</div>
|
||||||
<script src="http://danby.aniere.fr:3000/socket.io/socket.io.js"></script>
|
<script src="https://danby.aniere.fr:3000/socket.io/socket.io.js"></script>
|
||||||
<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>
|
<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>
|
||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
var socket = io("ws://danby.aniere.fr:3000");
|
var socket = io("https://danby.aniere.fr:3000");
|
||||||
|
|
||||||
socket.on("update-count", (data) => {
|
socket.on("update-count", (data) => {
|
||||||
document.getElementById("value").innerText = data.value;
|
document.getElementById("value").innerText = data.value;
|
||||||
|
Loading…
Reference in New Issue
Block a user