我购买了 GoDaddy 标准 SSL 证书并将其安装在http://mysite.com上。现在https://mysite.com运行良好。
现在,我想为在http://mysite.com:3000运行的 socket.io 安装证书
我尝试通过以下方式连接 SSL:
var socket = io.connect('https://www.mysite.com:3000', {secure:true});
但它不起作用。这是 server.js
var io = require('socket.io'),
connect = require('connect'),
mysql = require('mysql');
var app = connect().use(connect.static('../public_html/node/'));
app.listen(3000);
var server = io.listen(app);
server.sockets.on('connection', function(socket) {
socket.emit('getid', {message: "A New user is online"});
}
和客户端 index.html
<script type = "text/javascript" src = "http://www.mysite.com:3000/socket.io/socket.io.js"></script>
<script type = "text/javascript">
var socket = io.connect('http://www.mysite.com:3000');
</script>
有什么建议么?