27 lines
600 B
JavaScript
27 lines
600 B
JavaScript
#include sockchat_old.js
|
|
|
|
Umi.Server = (function() {
|
|
let proto = null;
|
|
|
|
return {
|
|
open: function(...args) {
|
|
proto = new Umi.Protocol.SockChat.Protocol(...args);
|
|
proto.open();
|
|
},
|
|
close: function() {
|
|
if(!proto)
|
|
return;
|
|
proto.close();
|
|
proto = null;
|
|
},
|
|
sendMessage: function(text) {
|
|
if(!proto)
|
|
return;
|
|
text = (text || '').toString();
|
|
if(!text)
|
|
return;
|
|
proto.sendMessage(text);
|
|
},
|
|
};
|
|
})();
|