Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE9 error - connection timeout #238

Closed
svscorp opened this issue Apr 2, 2013 · 9 comments
Closed

IE9 error - connection timeout #238

svscorp opened this issue Apr 2, 2013 · 9 comments

Comments

@svscorp
Copy link

svscorp commented Apr 2, 2013

Hi.

I try to figure out why noVNC doesn't work in IE9. First of all I had a problem when SWF wasn't loaded. Just saw the message: 'canvas is not supported'.

I've found that it is because I didn't use meta tag with IE=9. Probably it will helps someone:

But after that I went to the new issue. Connection timeout. With IE10 - it works. With other browsers it works as well. IE9 not.

Here us log. May be someone knows where the trick?

LOG: Forcing uncached load of WebSocketMain.swf
LOG: >> RFB.constructor
LOG: >> Display.constructor
LOG: User Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
LOG: Browser: trident 6
LOG: No scaling support
LOG: Setting viewport to full display region
LOG: Prefering javascript operations
LOG: Data URI scheme cursor not supported
LOG: << Display.constructor
LOG: Using web-socket-js bridge. Flash version: 11
LOG: >> Keyboard.allKeysUp
LOG: << Keyboard.allKeysUp
LOG: No scaling support
LOG: Setting viewport to full display region
LOG: New state 'loaded', was 'disconnected'. Msg: noVNC ready: WebSockets emulation, canvas rendering
LOG: << RFB.constructor
LOG: >> Keyboard.allKeysUp
LOG: << Keyboard.allKeysUp
LOG: New state 'connect', was 'loaded'.
LOG: >> RFB.connect
LOG: connecting to wss://host:port/hash
LOG: << RFB.connect
LOG: >> Keyboard.allKeysUp
LOG: << Keyboard.allKeysUp
LOG: Closing WebSocket connection
LOG: New state 'failed', was 'connect'. Msg: Connect timeout
LOG: Clearing connect timer
LOG: >> WebSock.onclose
LOG: Received onclose while disconnected
LOG: << WebSock.onclose
LOG: >> Keyboard.allKeysUp
LOG: << Keyboard.allKeysUp
LOG: New state 'failed', was 'failed'.

@AudriusButkevicius
Copy link

I have the same issue.

IE10 supports native websockets, thats why it works, though IE9 uses the SWF emulation which I haven't been able to force to work.

@svscorp
Copy link
Author

svscorp commented Apr 4, 2013

JarOfJan, read this: https://github.com/kanaka/websockify/tree/master/include/web-socket-js

The problem was with 843 port and crpossdomain policy (because SWF needs to have this to connect).

@svscorp svscorp closed this as completed Apr 4, 2013
@smithkl42
Copy link

I'm having the same trouble. Among the things I've done to troubleshoot:

  • Set Util._log_level = "debug". More information, but nothing that seems to help.
  • Set WEB_SOCKET_DEBUG = 1. So far as I can tell, no additional messages at all.
  • Run Flash policy server on port 843, not just on the websockets port (for me, 5901). I can connect to this from the machine in question, and it responds appropriate to policy server requests, but it never gets called by the WebSocketMain.swf file.
  • Switch to WebSocketMainInsecure.swf. No difference, so far as I can tell.

Here are the logs:

LOG: Trying to connect to RFB server 
LOG: >> RFB.constructor 
LOG: >> Display.constructor 
LOG: User Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C) 
LOG: Browser: trident 6 
LOG: No scaling support 
LOG: Setting viewport to full display region 
Data URI scheme cursor not supported 
LOG: << Display.constructor 
Using web-socket-js bridge. Flash version: 11 
LOG: >> Keyboard.allKeysUp 
LOG: << Keyboard.allKeysUp 
LOG: No scaling support 
LOG: Setting viewport to full display region 
New state 'loaded', was 'disconnected'. Msg: noVNC ready: WebSockets emulation, canvas rendering 
LOG: RFB state: loaded, msg: noVNC ready: WebSockets emulation, canvas rendering 
LOG: << RFB.constructor 
LOG: >> Keyboard.allKeysUp 
LOG: << Keyboard.allKeysUp 
New state 'connect', was 'loaded'. 
LOG: >> RFB.connect 
LOG: connecting to ws://app.dev.alanta.com:5901/ 
Skipping unsupported WebSocket binary sub-protocol 
LOG: << RFB.connect 
LOG: RFB state: connect, msg: undefined 
LOG: >> Keyboard.allKeysUp 
LOG: << Keyboard.allKeysUp 
LOG: Closing WebSocket connection 
New state 'failed', was 'connect'. Msg: Connect timeout after 5 seconds 
LOG: Clearing connect timer 

Any additional troubleshooting steps?

@smithkl42
Copy link

I should also note that the issue may have something to do with the Flash initialization.

For starters, the swfobject callback below does get called, with e.success==true.

swfobject.embedSWF(
  WEB_SOCKET_SWF_LOCATION,
  "webSocketFlash",
  "1" /* width */,
  "1" /* height */,
  "10.0.0" /* SWF version */,
  null,
  null,
  {hasPriority: true, swliveconnect : true, allowScriptAccess: "always"},
  null,
  function(e) {
    if (!e.success) {
      logger.error("[WebSocket] swfobject.embedSWF failed");
    }
  }
);

Nevertheless, I don't think it's getting initialized correctly. One of the first things the WebSocketMain.swf file is supposed to do is call WebSocket.__onFlashInitialized, like so:

  public function WebSocketMain() {
    // various stuff....
    ExternalInterface.call("WebSocket.__onFlashInitialized");
  }

However, this doesn't seem to happen - when I set a breakpoint in the JS, the WebSocket.__onFlashInitialized never seems to get called. So presumably that's where the problem is located. Still digging...

@infernix
Copy link

This should really be reopened. I'm having the exact same issue.

Things I did:

  • Install debug flash player. Doesn't even create a log.
  • Updated the swf. No change
  • Run ruby web_socket.rb on port 843, with various options for to-ports and domain (even "*"). Though it shouldn't matter in my case since everything is running on the same server.

Running wireshark shows that there's actually a connection being made to the target port, and it's correctly requesting /websockify. It also shows that it tries to connect to port 843.

Here's my log:

LOG: >> RFB.constructor
LOG: >> Display.constructor
LOG: User Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
LOG: Browser: trident 6
LOG: No scaling support
LOG: Setting viewport to full display region
Data URI scheme cursor not supported
LOG: << Display.constructor
Using web-socket-js bridge. Flash version: 11
LOG: >> Keyboard.allKeysUp
LOG: << Keyboard.allKeysUp
LOG: No scaling support
LOG: Setting viewport to full display region
New state 'loaded', was 'disconnected'. Msg: noVNC ready: WebSockets emulation, canvas rendering
LOG: << RFB.constructor
LOG: >> Keyboard.allKeysUp
LOG: << Keyboard.allKeysUp
New state 'connect', was 'loaded'.
LOG: >> RFB.connect
LOG: connecting to ws://xxxxxxxx:40000/websockify
Skipping unsupported WebSocket binary sub-protocol
LOG: << RFB.connect
LOG: >> Keyboard.allKeysUp
LOG: << Keyboard.allKeysUp
LOG: Closing WebSocket connection
New state 'failed', was 'connect'. Msg: Connect timeout
LOG: Clearing connect timer
LOG: >> Keyboard.allKeysUp
LOG: << Keyboard.allKeysUp
New state 'disconnected', was 'failed'.
LOG: >> WebSock.onopen
LOG: Server chose sub-protocol: base64
LOG: Already in state 'failed', ignoring.
LOG: << WebSock.onopen

@infernix
Copy link

Ha! after a lot of digging, I found the problem.

in rfb.js, when I change the conf.connectTimeout * 1000 to conf.connectTimeout * 4000, the problem goes away.

So it looks like it's a timing issue, and the default timeout should just be increased upwards from the 2 seconds if the swf is being used.

I don't really understand why though, because I had already changed "def_con_timeout = Websock_native ? 7 : 7" but it seems that that wasn't being used, which can be verified if you print the timer value in fail("Connect timeout").

@kanaka
Copy link
Member

kanaka commented Sep 12, 2013

websock.js must be getting loaded after rfb.js (Websock_native is set true or false by websock.js). IE9 is probably doing something weird with the order of dynamic loading of scripts.

@DirectXMan12
Copy link
Member

closing due to age and answer

@sanaeefar-saeed
Copy link

thx infernix .your soloution really worked.:D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants