38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!DOCTYPE html>
 | 
						|
<html>
 | 
						|
  <head>
 | 
						|
    <meta charset="utf-8">
 | 
						|
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
 | 
						|
    <title>Markdown preview</title>
 | 
						|
    <link href="http://thomasf.github.io/solarized-css/solarized-dark.min.css" rel="stylesheet"></link>
 | 
						|
    <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
 | 
						|
    <script>
 | 
						|
     (function($, undefined) {
 | 
						|
         var socket = new WebSocket("ws://localhost:7379");
 | 
						|
         socket.onopen = function() {
 | 
						|
             console.log("Connection established.");
 | 
						|
         };
 | 
						|
         socket.onclose = function(event) {
 | 
						|
             if (event.wasClean) {
 | 
						|
                 alert('Connection closed gracefully.');
 | 
						|
             } else {
 | 
						|
                 alert('Connection terminated.');
 | 
						|
             }
 | 
						|
             console.log('Code: ' + event.code + ' reason: ' + event.reason);
 | 
						|
         };
 | 
						|
         socket.onmessage = function(event) {
 | 
						|
             $("#markdown-body").html(event.data);
 | 
						|
         };
 | 
						|
         socket.onerror = function(error) {
 | 
						|
             alert("Error: " + error.message);
 | 
						|
         };
 | 
						|
     })(jQuery);
 | 
						|
    </script>
 | 
						|
  </head>
 | 
						|
  <body>
 | 
						|
    <article id="markdown-body">
 | 
						|
      <p>Markdown preview</p>
 | 
						|
    </article>
 | 
						|
  </body>
 | 
						|
</html>
 |