Node + SSL = SLOW

▼魔方 西西 提交于 2019-12-25 05:17:11

问题


I have set up a node.js-server for running a chat service used by our site. It works. However some customers are NOT able to connect (is done automatically via javascript). They never pop up in the list of connected users (in ie 7,8,9).

My site is running on https (port 443) and therefore my node.js-server is also running on SSL (port 8443) (with the same certificate).

I am using Node 0.6.20 (have tried numerous other versions). I have the following package-setup:

{
    "name":"My Chat",
    "description":"Chat app using socket.io",
    "version":"0.0.1",
    "dependencies":{
        "express":"3.x.x",
        "socket.io":"~0.8.7"
        },
    "engines":{"node":"0.6.20"}
}

and my node server looks like this:

var fs = require('fs');
var express = require('express');
var https = require('https');
var sio = require('socket.io');

var https_options = {
    pfx: fs.readFileSync('cert/certificate.pfx'),
    passphrase: "password"
};
var PORT = 8443;
var HOST = '0.0.0.0';


var myArray = new Object();
var userArray = {};
var nicknames = {};

app = express();

    app.use(app.router);

server = https.createServer(https_options, app).listen(PORT, HOST);
console.log('HTTPS Server listening on %s:%s', HOST, PORT);


var io = sio.listen(server);

io.set("transports", [ 'websocket'
   , 'flashsocket'
   , 'htmlfile'
   , 'polling'
   , 'xhr-polling'
   , 'jsonp-polling']);


// routes
app.get('/hey', function(req, res) {
    res.send('HEY!');
});
app.post('/ho', function(req, res) {
    res.send('HO!');
});

io.sockets.on('connection', function (socket) {


});

来源:https://stackoverflow.com/questions/25425031/node-ssl-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!