@joergmittaglawo/dmvconfig
Version:
DMV Configuration scripts for Lawo V__matrix Distributed Multiviewers.
1 lines • 647 B
JavaScript
export class Adapter{constructor(o){var s;const e=o.port?":"+o.port:"",t=`${null!==(s=o.protocol)&&void 0!==s?s:"ws"}://${o.ip}${e}/socket`;this.socket=new WebSocket(t)}send(o){this.socket.send(o)}close(){this.socket=void 0}reopen(){if(this.socket){const o=this.socket.onopen,s=this.socket.onclose,e=this.socket.onerror,t=this.socket.onmessage;this.socket.close(),this.socket=new WebSocket(this.socket.url),this.socket.onopen=o,this.socket.onclose=s,this.socket.onerror=e,this.socket.onmessage=t}return this}on_open(o){this.socket.onopen=o}on_close(o){this.socket.onclose=o}on_error(o){this.socket.onerror=o}on_message(o){this.socket.onmessage=o}}