FAQ
Juggernaut doesn't seem to be connecting.
Firstly make sure you're not behind a firewall. My school only lets data through port 80 (which is useless for xmlsocket connections). Apart from that the most likely thing that's wrong is that either the flash is trying to communicate with a port number below 1024:
The XMLSocket.connect method can connect only to TCP port numbers greater than or equal to 1024. Port numbers below 1024 are often used by system services such as FTP, Telnet, and HTTP, thus the XMLSocket object is barred from these ports for security reasons.Or that you're trying to communicate to a different domain.
The XMLSocket.connect method can connect only to computers in the same subdomain where the SWF file (movie) resides.Obviously the port number can be different than the one that the swf is served on. You can check to see what ports and addresses flash is trying to communicate with by looking at the html source. The port, address and channels are sent to flash via parameters in the swf address. The host in the parameters should be the same as the host the html file is served from (or at least in the same subdomain). Likewise you can check the port number is over 1024 here too.
What flash version does Juggernaut use?
Flash socket uses version 6 which is supported by more than 95% of users.
Does it work in all browsers?
It works in all the major ones: Firefox 1+, IE 6+ and Safari 2+.
What are the advantages/disadvantages of using a flash socket over other methods?
It's better than comet because:
- It's much less of a hack
- It doesn't crash your browser (Comet can do this after a while)
- 95% of browsers support it (flash 6).
- It's much easier to implement
- It can use a different port - unlike comet - so you don't need any custom dispatch servlets for forwarding messages through rails to the push server - it can connect directly.
It's better than polling because:
- Much cleaner
- Doesn't use as many server resources
Caveats are:
- It only works on ports above 1024 – which is blocked by some company firewalls. I'm working on getting round this. Any suggestions?
Why need an external push server - can't you make everything part of rails?
Rails uses FastCGI , each HTTP request to a rails app is handled by a whole rails process. Each rails process takes up more than ten megabytes, so for 100 push connections, more than 1000 mb would be needed. Because of this we need a webserver, external to Rails.
Why this VBScript hackery?
getURL("javascript:callFunction(data)") is by far the easiest way to call javascript functions from flash - however there's a catch. IE sets a limit of 508 chars on this method which is fine for small updates - but It will silently fail if you try and send a large partial. Instead I've used fscommand - which doesn't have this limitation (and also doesn't make a clicking noise in IE). However, again just for IE, you need a VBScript to get it working (the javascript auto detects browser, and dynamically adds the script if needed).
Doesn't a Ruby webserver take up a lot of resources and is quite slow?
With many threads you might see performance issues. My advice is to re-write the push server in C - please let me know if you've done this.
What are you doing to extend this?
My main aim is to get it working on ports lower that 1024 - if this is possible. I'm looking into using a binary connection - with flash 9 - or using Flex Data Services.
