(url?:string)
| 140 | worker: Worker; |
| 141 | |
| 142 | constructor(url?:string) { |
| 143 | let loc = url ? url : this.getUrl(); |
| 144 | |
| 145 | this.socket = new WebSocket(loc); |
| 146 | this.socket.onerror = (event) => { |
| 147 | this.onError(); |
| 148 | } |
| 149 | this.socket.onopen = (event) => { |
| 150 | this.onOpen(); |
| 151 | } |
| 152 | this.socket.onmessage = (event) => { |
| 153 | this.onMessage(event); |
| 154 | } |
| 155 | this.socket.onclose = (event) => { |
| 156 | this.onClose(); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | getUrl() { |
| 161 | let protocol = "ws://"; |