Reputation: 1149
Y have a problem in connection versión 1.0 that I dont had in the versión 0.9.X.
I have Django running in http://app.myhost.com and my node server in http://live.myhost.com:8001
Before I could connect me to the node server like:
Client:
io.connect(//live.myhost.com:8001);
server:
io.set('transports', ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling']);
but now I have a problem (not taking the live url correctly):
GET http://app.myhost.com:8000/socket.io/?EIO=2&transport=polling&t=1401468282894-1 404 (NOT FOUND)
if I rewrite (io.connect(http://live.myhost.com:8001)) now have a new problem:
XMLHttpRequest cannot load http://live.myhost.com:8001/socket.io/?EIO=2&transport=polling&t=1401468608168-1. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://app.myhost.com' is therefore not allowed access.
in debug mode to socket.io I have more info:
engine:core intercepting request for path "/socket.io/" +0ms
engine handling "GET" http request "/socket.io/?EIO=2&transport=polling&t=1401470024479-48" +0ms
engine unknown transport "polling" +3ms
Upvotes: 2
Views: 16579
Reputation: 111
In default Socket.IO 1.0.4
allows polling
and websocket
transports. You removed polling
transport by setting custom transports. Just return the polling
transport back:
io.set('transports', ['websocket',
'flashsocket',
'htmlfile',
'xhr-polling',
'jsonp-polling',
'polling']);
Updated Apr 3, 2015
0.9.15
is last version with valid set
method. Version 1.0.0-pre
removes set
method and introduces settings via server initialization. Version 1.0.0-pre2
adds original set
method for backward compatibility. Use new notation:
var socket = io({
transports: [
'websocket',
'flashsocket',
'htmlfile',
'xhr-polling',
'jsonp-polling',
'polling'
]
});
Upvotes: 11