@joergmittaglawo/dmvconfig
Version:
DMV Configuration scripts for Lawo V__matrix Distributed Multiviewers.
1 lines • 988 B
JavaScript
Object.defineProperty(exports,"__esModule",{value:!0}),exports.Adapter=void 0;const s=require("ws");exports.Adapter=class{constructor(e){var o,t;this.pars=e;const r=e.port?":"+e.port:"",c=`${null!==(o=e.protocol)&&void 0!==o?o:"ws"}://${e.ip}${r}/socket`;this.socket_opts={servername:"",maxPayload:null!==(t=e.max_payload_size)&&void 0!==t?t:1048576,rejectUnauthorized:e.reject_unauthorized},this.socket=new s(c,this.socket_opts)}send(s){this.socket.send(s)}close(){try{this.socket.removeAllListeners(),this.socket.terminate()}finally{this.socket=void 0}}reopen(){if(this.socket){const e=this.socket.onopen,o=this.socket.onclose,t=this.socket.onerror,r=this.socket.onmessage;this.socket.close(),this.socket=new s(this.socket.url,this.socket_opts),this.socket.onopen=e,this.socket.onclose=o,this.socket.onerror=t,this.socket.onmessage=r}return this}on_open(s){this.socket.onopen=s}on_close(s){this.socket.onclose=s}on_error(s){this.socket.onerror=s}on_message(s){this.socket.onmessage=s}};