/[projects]/miscJava/Test3/src/main/webapp/WebsockTest.html
ViewVC logotype

Diff of /miscJava/Test3/src/main/webapp/WebsockTest.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

miscJava/Test3/WebContent/WebsockTest.html revision 2113 by torben, Tue Feb 11 12:44:13 2014 UTC miscJava/Test3/src/main/webapp/WebsockTest.html revision 2446 by torben, Fri Mar 20 08:12:57 2015 UTC
# Line 22  function append(str) { Line 22  function append(str) {
22  function sendMessage() {  function sendMessage() {
23          try {          try {
24                  var txt = $("#txt").val();                  var txt = $("#txt").val();
25                    txt = $.trim(txt);
26                  //append(txt);                  //append(txt);
27                    if (txt == "")
28                            return;
29                                    
30                  socket.send( "CHAT#" + txt);                  socket.send( "CHAT#" + txt);
31                                    
# Line 54  $( function() { Line 57  $( function() {
57                      setActTime();                      setActTime();
58                  }                  }
59                    
60                    socket.onerror = function(evt) {
61                            append("*** Error om client websocket ***");
62                    }
63            
64                  socket.onclose = function(){                  socket.onclose = function(){
65                          var now = new Date().getTime();                          var now = new Date().getTime();
66                          var elapsed = now - actTime;                          var elapsed = now - actTime;
# Line 73  $( function() { Line 80  $( function() {
80                  var nick = $("#nick").val();                  var nick = $("#nick").val();
81                  nick = $.trim(nick);                  nick = $.trim(nick);
82                                    
83                    if (nick == "") {
84                            alert("Nick can not be empty");
85                            return;
86                    }
87                    
88                  try {                  try {
89                          socket.send( "NICK#" + nick);                                            socket.send( "NICK#" + nick);                  
90                  } catch(exception) {                  } catch(exception) {
# Line 87  $( function() { Line 99  $( function() {
99                  }                  }
100          });          });
101                    
102            $(window).unload(function(){
103                    socket.close();
104            });
105            
106  });  });
107    
108    

Legend:
Removed from v.2113  
changed lines
  Added in v.2446

  ViewVC Help
Powered by ViewVC 1.1.20