Internet Explorer 8 and AutoBahn JS and web-socket-js

1,241 views
Skip to first unread message

Hans Ahrens

unread,
Aug 14, 2012, 8:10:17 AM8/14/12
to ratch...@googlegroups.com
Hello, 

When i try to use the Ratchet Wamp server on IE8 in combination with AutoBahn JS and web-socket-js i get an [object-error] without any line number indicating the problem..
I looked at the socketo demo and saw that it also used the above combination and that it worked in IE8 so i copied the scripts that i thought i would need but this did not fix the problem i keep getting the same error.
Then i tried to exclude AutoBahn JS and then i could trace the message to the Browser and that worked. But i don't want to build an entire WAMP implementation in javascript when AutoBahn JS already has the complete implementation.

The only difference that i can think about at the moment is that i am running a different server then you are. 
Could you tell me if you did anything specifically to get IE8 to work or what i can do to get it up and running ? 

The version of ratchet that i am using is : Ratchet\/0.1.5
And this are the php line's that i am using to start the server : 
 
    $server = IoServer::factory(
       
new WsServer(
       
new WampServer(
           
new myClass
           
)
       
)
     
, 90
   
);

    $server
->run();


Thanks in advance you for your reaction.
 
Best Regards,
Hans

Hans Ahrens

unread,
Aug 14, 2012, 8:25:15 AM8/14/12
to ratch...@googlegroups.com
 Since i cant update my original post i also have the same problem in ie9 and i really need to support that one since it's the most current version available.

cboden

unread,
Aug 14, 2012, 8:52:57 AM8/14/12
to ratch...@googlegroups.com
Hi Hans,

The demo is currently running on the v0.2-beta branch but it used to run on all the v0.1.* tags successfully with IE6, 7, 8, and 9.  

First I would suggest trying the v0.2-beta branch, I don't think there will be any more changes before it becomes an official tag, I'm just trying to finish updating website documentation to match the release.  If you do this, check the CHANGELOG.md file as the WampServer class was renamed and another class called WampServer replace the one from v0.1.5.

If that doesn't work I would think it's a miss-match between client and server versions.  Try implementing the version of AutobahnJS and web-socket-js that are running the demo.  The composer.log file in Ratchet-examples _should_ match the versions that are running in the demo.  Please let me know if this fixes your problem.  If so, I may need to patch Ratchet to work with these latest client versions.

Cheers.

cboden

unread,
Aug 14, 2012, 8:57:30 AM8/14/12
to ratch...@googlegroups.com
Are you running an additional script?  For IE <= 9 to connect via WebSocket it uses Flash sockets.  To connect with a Flash socket it must first do this silly XML check on port 843.  In addition to your server script you pasted above you need to run another one to server XML to Flash sockets.  See the code at the bottom of this doc page: http://socketo.me/docs/flash


On Tuesday, 14 August 2012 08:25:15 UTC-4, Hans Ahrens wrote:

Hans Ahrens

unread,
Aug 14, 2012, 10:26:59 AM8/14/12
to ratch...@googlegroups.com
Hi Cboden,

Thank you for your quick response.
I was running 2 different script one for ratchet and one for the flash policy.

I also updated to Ratchet to version : Ratchet\/0.2b.
Further more i also updated the website demo with the file's i got from your demo. 
I didn't use the composer.lock file because well i didn't know how it would get me the autobahn file's ? 

After i did the above steps i tried it again and it didn't work. 
I also created a demo without ratchet and that does receive response from the server without error's 

The HTML demo file with AutoBahn looks like this : 

  <script type="text/javascript" src="swfobject.js"></script>
  <script type="text/javascript" src="web_socket.js"></script>

  <script type="text/javascript">
    
    // Set URL of your WebSocketMain.swf here:
    WEB_SOCKET_SWF_LOCATION = "WebSocketMain.swf";
    // Set this to dump debug message from Flash to console.log:
    WEB_SOCKET_DEBUG = true;
  
  </script>
  
  <script type="text/javascript" src="when.js"></script>
  <script type="text/javascript" src="autobahn.js"></script>
  <script type="text/javascript">  
    // Everything below is the same as using standard WebSocket.
    
    var ws;
    var sess;
    
    function init() {   
sess = new ab.Session("ws://server:port/",open,closed);
}
    
    function open(){
   output("Open");
    }   
    
    function closed(reason){
    output(reason);
   output("Closed");
    } 
    
    function output(str) {
      var log = document.getElementById("log");
      var escaped = str.replace(/&/, "&amp;").replace(/</, "&lt;").
        replace(/>/, "&gt;").replace(/"/, "&quot;"); // "
      log.innerHTML = escaped + "<br>" + log.innerHTML;
    }


When i change the init() code to the following to bypass AutoBahn i see the welcome message from the server : 

      var conn = new WebSocket('ws://server:port/');
      conn.onmessage = function(e) {
        output(e.data);
       };

Further more i also attached all the demo file's  that i am using to this post
Is there anything else i should/can do to make it work  ? 
websocketInternetExplorerTest.zip

cboden

unread,
Aug 14, 2012, 1:27:41 PM8/14/12
to ratch...@googlegroups.com
Hi Hans,

Thanks for the thorough report.  I will download your server and then try to replicate and fix the issue.  

I'm very busy with a new job so I may not be able to tackle this until the weekend.

Cheers,
 -- Chris.

Hans Ahrens

unread,
Aug 17, 2012, 2:45:38 AM8/17/12
to ratch...@googlegroups.com
Hi Chris,

Thank you for your response.
I did some more tests today and i solved the problem today, 
What i did was manualy place the following div in to the top of the html body : 
     <div id="webSocketFlash"></div>

After i added the div it worked immediately. When i added the div i also did some test with Ratchet v0.1.5 and that also worked. Also newer scripts of web-js started working.
I dont know why i needed to add it manually since it should go automatic but thats not a Ratchet problem :)

There is one thing that i couldnt solve and that was Internet Explorer 7 i could not get it to work under there but thats no problem since we are not going to officialy support it.
Thank you for your help with the problem but you don't need to spend time in your weekend to solve this problem :).

Best Regards,
Hans
Reply all
Reply to author
Forward
0 new messages