trying to fix https issue

This commit is contained in:
Kasper Rynning-Tønnesen
2015-06-11 14:56:57 +02:00
parent 690ccc1bc2
commit abdb3423fc
2 changed files with 16 additions and 4 deletions

View File

@@ -1,8 +1,20 @@
var fs = require('fs');
var http = require('http');
var https = require('https');
var privateKey = fs.readFileSync('/etc/apache2/ssl/private.key', 'utf8');
var certificate = fs.readFileSync('/etc/apache2/ssl/ssl.crt', 'utf8');
var credentials = {key: privateKey, cert: certificate};
// your express configuration here
//var httpServer = http.createServer(app);
var httpsServer = https.createServer(credentials, app);
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io')(server);
//var server = require('http').createServer(app);
var io = require('socket.io')(httpsServer);
//db
var mongojs = require('mongojs');
@@ -14,7 +26,7 @@ var crypto = require('crypto');
var port = 3000;
var lists = [];
server.listen(port, function () {
httpsServer.listen(port, function () {
console.log('Server listening at port %d', port);
});

View File

@@ -82,7 +82,7 @@ $(document).ready(function (){
list_html = $("#channels").html();
$("#channels").empty();
var socket = io.connect('//'+window.location.hostname+':3000');
var socket = io.connect('https://'+window.location.hostname+':3000');
var playlists = [];
socket.emit('frontpage_lists');
socket.on('playlists', function(msg){