juggernaut icon indicating copy to clipboard operation
juggernaut copied to clipboard

Setting location of WebSocketMain.swf

Open RKelln opened this issue 14 years ago • 1 comments

I'm having great difficulty setting the location of WebSocketMain.swf.

(Note: that I'm loading application.js from my web server, not the jug server, but regardless I want to be able to specify what server and location to get WebSocketMain.swf).

Regardless of how and when I set window.WEB_SOCKET_SWF_LOCATION in the client js, I can't override the defaults. The code in application.js looks wrong:

if (typeof window != 'undefined'){
    WEB_SOCKET_SWF_LOCATION = '/WebSocketMain.swf';
}

Should it be something like?

if (typeof window !== 'undefined' && typeof window.WEB_SOCKET_SWF_LOCATION === 'undefined'){
    window.WEB_SOCKET_SWF_LOCATION = '/WebSocketMain.swf';
}

It actually looks like WEB_SOCKET_SWF_LOCATION is handled rather inconsistently throughout:

if (typeof window != 'undefined'){
  if (typeof WEB_SOCKET_SWF_LOCATION === 'undefined')
    WEB_SOCKET_SWF_LOCATION = '/socket.io/lib/vendor/web-socket-js/WebSocketMain.swf';
}

Perhaps something like:

function setWebSocketSWFDefault(path) {
  if (typeof window !== 'undefined' && typeof window.WEB_SOCKET_SWF_LOCATION === 'undefined'){
    window.WEB_SOCKET_SWF_LOCATION = path;
  }
}

When I try to fix things and then test in my rails app using cucumber I get a bunch of bizarreness where WEB_SOCKET_SWF_LOCATION is set to: /socket.io/lib/vendor/web-socket-js/WebSocketMain.swf as well as what I'm trying to set it to in the client.

RKelln avatar Jun 18 '11 00:06 RKelln

Hah! I was just going to report this too. Definitely a bug.

inspire22 avatar Jun 18 '11 23:06 inspire22