require('../SimpleWebsocket').create
({
  port:8100,
  timeout:{keepAlive:5000,firstShake:5000},
  onTextOK:function(text){
    console.log(text);
    this.socket.write('--b testboundary');
    this.socket.write('OK,'+text.length+' charactors received, `'+text+'`');
    this.socket.write('testboundary--');
  },
  onBinaryOK:function(data){
    console.log(data);
    this.socket.write('--b testboundary');
    this.socket.write('OK,'+data.length+' bytes received, `'+data+'`');
    this.socket.write('testboundary--');
  },
  onClose:function(reason,code){
    console.log(this.socket.id);
  },
  debug:true,
  allowBinary:true,
  enableRule:{
    text:{
      requireHead:true,
      joinMessage:true
    },
    binary:{
      requireHead:true,
      joinMessage:true
    }
  }
});


@@ -1,12 +1,511 @@
+var sendData=function(data,socket,keepString)%7B%0A  data=data%7C%7C%7B%7D;%0A  socket.write(function(head)%7B%0A    var heads=%5B%5D;%0A    for(var what in head)%0A      heads.push('--'+what.charAt(0)+' '+head%5Bwhat%5D);%0A    if(keepString!==undefined)heads.push('--r '+keepString);%0A    return heads.join('%5Cn');%0A  %7D(data.header=data.header%7C%7C%7Bnodata:''%7D));%0A  if(!data.header.boundary)return;%0A  if(data.json%7C%7Cdata.text)%7B%0A    socket.write(data.text%7C%7CJSON.stringify(data.json));%0A    socket.write(data.header.boundary+'--');%0A  %7D%0A%7D;%0A%0A
 require('../
@@ -505,11 +505,8 @@
 re('
-../
 Simp
@@ -606,24 +606,29 @@
 unction(text
+,head
 )%7B%0A    conso
@@ -649,69 +649,46 @@
     
-this.socket.write('--b testboundary');%0A    this.socket.write(
+sendData(%7B%0A      header:%7B%0A        msg:
 'OK,
@@ -739,49 +739,74 @@
 +'%60'
-);
+,
 %0A    
-this.socket.write('testboundary--'
+    nodata:''%0A      %7D%0A    %7D,this.socket,head.keep%7C%7Cundefined
 );%0A 
@@ -835,16 +835,21 @@
 ion(data
+,head
 )%7B%0A    c
@@ -874,69 +874,46 @@
     
-this.socket.write('--b testboundary');%0A    this.socket.write(
+sendData(%7B%0A      header:%7B%0A        msg:
 'OK,
@@ -959,49 +959,129 @@
 +'%60'
-);
+,
 %0A    
-this.socket.write('testboundary--'
+    nodata:''%0A      %7D%0A    %7D,this.socket,head.keep%7C%7Cundefined);%0A  %7D,%0A  onHeader:function(text)%7B%0A    console.log(text
 );%0A 
@@ -1138,23 +1138,16 @@
 og(this.
-socket.
 id);%0A  %7D
@@ -1152,22 +1152,8 @@
  %7D,%0A
-  debug:true,%0A
   al
@@ -1323,8 +1323,10 @@
  %7D%0A%7D);%0A%0A
+%0A%0A

Update server.js