<!DOCTYPE HTML>
<html>                                                                           
<head>                                                                           
    <title>Threatintel WebSocket Test</title>                                                   
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
    <script src="http://d3js.org/d3.v3.min.js"></script>
    <script type="text/javascript" charset="utf-8">                              
        $(document).ready(function(){                                            
            $('form').submit(function(event){                                    
                ws.send($('#data').val())                                        
                return false;                                                    
            });                                                                  
            if ("WebSocket" in window) {                                         
                ws = new WebSocket("ws://" + document.domain + ":34567/api");                
                ws.onmessage = function (msg) {                                  
                    $("#log").append("<p>"+msg.data+"</p>")                      
                };                                                               
            } else {                                                             
                alert("WebSocket not supported");                                
            }                                                                    
        });                                                                      
    </script>                                                                    
</head>                                                                          
<body>                                                                           
    <h1>Send:</h1>                                                               
    <form method='POST' action='#'>                                              
        <textarea name='data' id="data"></textarea>                              
        <div><input type='submit'></div>                                         
    </form>                                                                      
    <h1>Receive:</h1>                                                            
    <div id="log"></div>                                                         
</body>                                                                          
</html>                                  