Cloud 66 support for WebSocket

Notice

This documentation set has been merged with the Maestro Version 2 documentation and is officially deprecated. These pages will be redirected to their equivalents in that doc set within the next few weeks.

WebSocket is a protocol that allows bi-directional web communication between client and server.

Cloud 66 configuration for WebSocket

Cloud 66 opens 8080 and 8443 ports by default on your servers to allow you to use WebSocket.

If you want to use WebSocket with Cloud 66, your WebSocket servers need to listen to the following ports:

You can use a different port to use WebSocket (not supported by Cloud 66) but you will need manually open the ports to allow external connections to your servers.

Find out more about service networking.

WebSocket through a load balancer

You can use a load balancer and scale up your servers to have more redundancy and capacity for your WebSocket servers.

Note

ELB (Amazon) doesn’t support WebSocket traffic.

Learn more about Cloud 66 HAProxy and WebSocket setup.

On Linode alternative HTTP ports 8080 and 8443 are opened on NodeBalancers and can be used for WebSockets.

Test your WebSocket server

To test your WebSocket server, create a .html file with the code below, make sure to replace <your_address> with your WebSocket server IP address and finally, open it in a web browser.

<html>
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
      <script>
      $(document).ready(function(){
        function debug( str ) {
          $("#debug").append( str );
        };

        ws = new WebSocket("ws://your address");
        ws.onmessage = function(evt) {
          $("#msg").append("evt.data");
        };
        ws.onclose = function() {
          debug("socket closed");
        };
        ws.onopen = function() {
          debug("connected...");
          ws.send("hello server");
        };
      });
    </script>
  </head>
  <body>
    <div id="debug"></div>
    <div id="msg"></div>
  </body>
</html>