The limitation here is the same origin policy enforced by the browser.
The long-polling transport cometd uses by default uses XHR to
send/recv messages to and from the coweb server. XHR can only contact
a server under the same domain as the web app. The proxy hides this
problem by making the web app (PHP in your case) and the coweb server
(Java or Python) appear to come from the same domain.
The Java implementation of CometD supports callback-polling, however,
which should work cross-domain. We've never tested it, but it may just
work. Also, CometD supports WebSockets which do allow cross-domain
connections with the right set of headers. We've currently disabled
websocket as a transport in coweb though because the spec is in flux
and not implemented uniformly across browsers.
Pete
--
Pete
Actually, I realized after sending the mail that you'd fail contacting
the admin REST API across domains, so, no, it won't work without
improving that request to use CORS or something else.
> Basides, you mentioned that the websocket has been disabled. Is it
> still part of the code that can be enabled, configured, and tested in
> different browsers?
> Does not Dojo.WebSocket solve the cross-browser issues?
It's commented out in cometd.js. We can (should) make
enabling/disabling it a configuration option in cowebConfig.
dojo.io uses WebSocket if it's available, but it doesn't solve that
WebSocket is at different implementation levels in different browsers
(http://en.wikipedia.org/wiki/WebSockets#Browsers_supporting_WebSocket).
Your server has to speak the same version WebSocket protocol as the
browser. Besides, 1) Dojo isn't a dependency for OCW and 2) cometd
does select fallbacks for missing WebSocket support (i.e.,
long-polling like it's doing right now.)
> regards,
> Navid
>
>> The Java implementation of CometD supports callback-polling, however,
>> which should work cross-domain. We've never tested it, but it may just
>> work. Also, CometD supports WebSockets which do allow cross-domain
>> connections with the right set of headers. We've currently disabled
>> websocket as a transport in coweb though because the spec is in flux
>> and not implemented uniformly across browsers.
>>
>> Pete
>>
--
Pete