kurulmadan önce web soket bağlantısı kapalı ->https://github.com/Automattic/socket.io/issues/1846socket.io hatası - Bağlantı ben bu sayfadan biraz öğrenilen
işe soketleri için SSL gerekiyor mu?
Ben bulmacayı çözmek için orada, şimdiye kadar hiçbir çözüm ile uzun süre bu hata ile herhangi dahiler olabilir mücadele oldum?
My App Kod Sunucu tarafında yanlış öğeye socket.io takılarak olabilir
var express = require("express");
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.use(express.static(__dirname + '/html'));
http.listen(process.env.PORT || 3000, function(){
console.log('listening on *:', process.env.PORT || 3000);
new shell.Shell(app, io);
});
app.use(function(request, response, next){
response.header("Access-Control-Allow-Origin", "*");
response.header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS");
response.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Auth-Token");
request.id = self.id++;
next();
});
var self = this;
app.get("/", function(request, response) {
response.end("");
});
app.get("/entitlement/:uri", function(request, response){
self.delegate.entitlement(request, response);
});
app.get("/speakers", function(request, response) {
self.delegate.speaker(request, response);
});
app.get("/speakers/:id", function(request, response) {
self.delegate.speaker(request, response);
});
app.get("/sponsors", function(request, response){
self.delegate.sponsor(request, response);
});
app.get("/sponsors/:id", function(request, response) {
self.delegate.sponsor(request, response);
});
app.get("/agendas", function(request, response) {
self.delegate.agenda(request, response);
});
app.get("/agendas/:id", function(request, response) {
self.delegate.agenda(request, response);
});
app.get("/sessions/:id", function(request, response){
self.delegate.agenda(request, response);
});
app.get("/attendees", function(request, response) {
//self.delegate.attendee(request, response);
});
///attendees/:id to get chat history
io.on("connection", function(socket){
//self.delegate.connection(io, socket, null);
socket.on('get-age-in-dog-years', function(data, fn) {
console.log(data);
fn(data.age * 7) ;
});
socket.on("chat", function(chat){
//self.delegate.chat(io, socket, chat);
});
socket.on("disconnect", function(){
//self.delegate.disconnect(io, socket)
});
});
},
Bu, 400 hatalı istek hatasıdır. İstemci bir websocket bağlantısı bekliyor ve yükseltme el sıkışma olmayacak gibi görünüyor. Bir tcpdump yapabilir ve ws el sıkışma – spicyramen
görebildiğim kod satır birkaç yorumladı ve çalıştı, bu satırlar app.use middleware şeyler (başlık ile ilgili) içerir, ayrıca node_modules klasörü silinmiş ve kaydetme ile yeniden, (localhost üzerinde çalıştı düşünüyorum), – user2727195