Niepoprawny port Socket.IO node.js Web 8080
Widziałem kilka postów na tym forum dotyczących Socket.IO i node.js. Ale nadal nie działa optymalnie.
port 80 i port 8080 są używane przez mój serwer dla różnych aplikacji. W App.js i moim połączeniu z gniazdem dodałem port 8081 zamiast 8080.
Dostaję komunikat o nieprawidłowym połączeniu z serwerem internetowym. Po mniej więcej 10 sekundach stworzył on websocket i mogę go używać doskonale.
Ale 10 sekund to za długo. Jakieś pomysły, jak to naprawić?
script.js:
<script>
var socket = io.connect('http://domainname.nl:8081');
socket.on('connect', function(){
socket.emit('adduser', "<?php echo $user->first_name; ?>");
});
app.js
var app = require('express').createServer()
var io = require('socket.io').listen(8081);
app.listen(8081);
// routing
app.get('/', function (req, res) {
res.sendfile(__dirname + '/index.html');
});
AKTUALIZACJA:
Kiedy to zmieniłam. Wciąż mam problem. Gniazda działają, ale połączenie trwa 10 sekund
info - socket.io started
debug - served static /socket.io.js
debug - client authorized
info - handshake authorized 15619940591959058675
debug - setting request GET /socket.io/1/websocket/15619940591959058675
debug - set heartbeat interval for client 15619940591959058675
warn - websocket connection invalid
info - transport end
debug - set close timeout for client 15619940591959058675
debug - cleared close timeout for client 15619940591959058675
debug - cleared heartbeat interval for client 15619940591959058675
debug - client authorized for
debug - setting request GET /socket.io/1/xhr-polling/15619940591959058675?t=1345479037596
debug - setting poll timeout
debug - clearing poll timeout