client
var socket=io('https://site.com:3000');
socket.on('connect', function (){
code ...
});
server
var fs = require('fs');
//var cors = require('cors');
var options = {
key: fs.readFileSync('abe5c05b1.key'),
cert: fs.readFileSync('b319649cbd8fb1a80.crt')
};
var http = require('https').createServer(options);
var io = require('socket.io')(http, {
cors: {
origin: 'https://site.com'
}
});
var helper = require('./utils/helper');
http.listen(3000, function(){
console.log('listening on *:3000');
});
.htaccess
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "https://site.com:3000"
Header add Access-Control-Allow-Headers *
Header add Access-Control-Allow-Methods "GET, PUT, POST, DELETE, HEAD, OPTIONS"
</IfModule>
при запуске сервера, примерно пол минуты сервер думает затем сбрасывает ошибку socket.js:108
this.pingIntervalTimer.refresh();
TypeError: this.pingIntervalTimer.refresh is not a function