socket.io https ERR_SSL_PROTOCOL_ERROR

时间:2017-03-21 22:47:05

标签: https socket.io cloudflare

所以基本上我一直试图让https与我的socket.io

一起工作

服务器代码:

var express = require('express');
var app = express();
var httpsapp = express();
var https = require('https');
var fs = require("fs");
var server = https.createServer({
  key: fs.readFileSync('key.pem').toString(),
  cert: fs.readFileSync('cert.crt').toString(),
  ca: fs.readFileSync('ca.pem').toString()
  }, httpsapp);
var io = require('socket.io').listen(server);
var io = io.listen(8080);
(A whole bunch of socket.on's and one that sends one per second (they did work without https))

客户代码:

var socket = io('https://server.com:8080', {secure: true});

我因为ERR_SSL_PROTOCOL_ERROR错误而被填满 有谁知道如何解决这个问题?

编辑:证书来自cloudflare

0 个答案:

没有答案