Simon Hunt | 1e4a001 | 2015-01-21 11:36:08 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | ONOS GUI -- Remote -- Web Socket Service |
| 19 | */ |
| 20 | (function () { |
| 21 | 'use strict'; |
| 22 | |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 23 | // injected refs |
Simon Hunt | ab34ecb | 2015-12-11 13:14:48 -0800 | [diff] [blame] | 24 | var $log, $loc, fs, ufs, wsock, vs, ls; |
Simon Hunt | 1e4a001 | 2015-01-21 11:36:08 -0800 | [diff] [blame] | 25 | |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 26 | // internal state |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 27 | var webSockOpts, // web socket options |
| 28 | ws = null, // web socket reference |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 29 | wsUp = false, // web socket is good to go |
| 30 | sid = 0, // event sequence identifier |
| 31 | handlers = {}, // event handler bindings |
| 32 | pendingEvents = [], // events TX'd while socket not up |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 33 | host, // web socket host |
Thomas Vachuska | b6acc7b | 2015-03-11 09:11:21 -0700 | [diff] [blame] | 34 | url, // web socket URL |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 35 | clusterNodes = [], // ONOS instances data for failover |
| 36 | clusterIndex = -1, // the instance to which we are connected |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 37 | connectRetries = 0, // limit our attempts at reconnecting |
| 38 | openListeners = {}, // registered listeners for websocket open() |
| 39 | nextListenerId = 1; // internal ID for open listeners |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 40 | |
| 41 | // ======================= |
| 42 | // === Bootstrap Handler |
Simon Hunt | acf410b | 2015-01-23 10:05:48 -0800 | [diff] [blame] | 43 | |
Thomas Vachuska | b6acc7b | 2015-03-11 09:11:21 -0700 | [diff] [blame] | 44 | var builtinHandlers = { |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 45 | bootstrap: function (data) { |
Thomas Vachuska | 20084b7 | 2015-03-11 13:46:50 -0700 | [diff] [blame] | 46 | clusterNodes = data.clusterNodes; |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 47 | clusterNodes.forEach(function (d, i) { |
| 48 | if (d.uiAttached) { |
| 49 | clusterIndex = i; |
Thomas Vachuska | 20084b7 | 2015-03-11 13:46:50 -0700 | [diff] [blame] | 50 | $log.info('Connected to cluster node ' + d.ip); |
| 51 | // TODO: add connect info to masthead somewhere |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 52 | } |
| 53 | }); |
| 54 | } |
| 55 | }; |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 56 | |
| 57 | // ========================== |
| 58 | // === Web socket callbacks |
| 59 | |
| 60 | function handleOpen() { |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 61 | $log.info('Web socket open - ', url); |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 62 | vs.hide(); |
| 63 | |
Simon Hunt | 4deb0e8 | 2015-06-10 16:18:25 -0700 | [diff] [blame] | 64 | if (fs.debugOn('txrx')) { |
| 65 | $log.debug('Sending ' + pendingEvents.length + ' pending event(s)...'); |
| 66 | } |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 67 | pendingEvents.forEach(function (ev) { |
| 68 | _send(ev); |
| 69 | }); |
| 70 | pendingEvents = []; |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 71 | |
| 72 | connectRetries = 0; |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 73 | wsUp = true; |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 74 | informListeners(host, url); |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | // Handles the specified (incoming) message using handler bindings. |
| 78 | function handleMessage(msgEvent) { |
| 79 | var ev, h; |
| 80 | |
| 81 | try { |
| 82 | ev = JSON.parse(msgEvent.data); |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 83 | } catch (e) { |
Simon Hunt | 2d16fc8 | 2015-03-10 20:19:52 -0700 | [diff] [blame] | 84 | $log.error('Message.data is not valid JSON', msgEvent.data, e); |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 85 | return null; |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 86 | } |
Simon Hunt | 4deb0e8 | 2015-06-10 16:18:25 -0700 | [diff] [blame] | 87 | if (fs.debugOn('txrx')) { |
| 88 | $log.debug(' << *Rx* ', ev.event, ev.payload); |
| 89 | } |
Simon Hunt | 2d16fc8 | 2015-03-10 20:19:52 -0700 | [diff] [blame] | 90 | |
| 91 | if (h = handlers[ev.event]) { |
| 92 | try { |
| 93 | h(ev.payload); |
| 94 | } catch (e) { |
| 95 | $log.error('Problem handling event:', ev, e); |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 96 | return null; |
Simon Hunt | 2d16fc8 | 2015-03-10 20:19:52 -0700 | [diff] [blame] | 97 | } |
| 98 | } else { |
| 99 | $log.warn('Unhandled event:', ev); |
| 100 | } |
| 101 | |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | function handleClose() { |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 105 | var gsucc; |
| 106 | |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 107 | $log.info('Web socket closed'); |
Simon Hunt | ab34ecb | 2015-12-11 13:14:48 -0800 | [diff] [blame] | 108 | ls.stop(); |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 109 | wsUp = false; |
| 110 | |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 111 | if (gsucc = findGuiSuccessor()) { |
| 112 | createWebSocket(webSockOpts, gsucc); |
| 113 | } else { |
| 114 | // If no controllers left to contact, show the Veil... |
| 115 | vs.show([ |
| 116 | 'Oops!', |
| 117 | 'Web-socket connection to server closed...', |
| 118 | 'Try refreshing the page.' |
| 119 | ]); |
| 120 | } |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | |
| 124 | // ============================== |
| 125 | // === Private Helper Functions |
| 126 | |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 127 | function findGuiSuccessor() { |
| 128 | var ncn = clusterNodes.length, |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 129 | ip, node; |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 130 | |
| 131 | while (connectRetries < ncn && !ip) { |
| 132 | connectRetries++; |
| 133 | clusterIndex = (clusterIndex + 1) % ncn; |
| 134 | node = clusterNodes[clusterIndex]; |
| 135 | ip = node && node.ip; |
| 136 | } |
| 137 | |
| 138 | return ip; |
| 139 | } |
| 140 | |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 141 | function informListeners(host, url) { |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 142 | angular.forEach(openListeners, function (lsnr) { |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 143 | lsnr.cb(host, url); |
| 144 | }); |
| 145 | } |
| 146 | |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 147 | function _send(ev) { |
Simon Hunt | 4deb0e8 | 2015-06-10 16:18:25 -0700 | [diff] [blame] | 148 | if (fs.debugOn('txrx')) { |
| 149 | $log.debug(' *Tx* >> ', ev.event, ev.payload); |
| 150 | } |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 151 | ws.send(JSON.stringify(ev)); |
| 152 | } |
| 153 | |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 154 | function noHandlersWarn(handlers, caller) { |
| 155 | if (!handlers || fs.isEmptyObject(handlers)) { |
| 156 | $log.warn('WSS.' + caller + '(): no event handlers'); |
| 157 | return true; |
| 158 | } |
| 159 | return false; |
| 160 | } |
| 161 | |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 162 | // =================== |
| 163 | // === API Functions |
| 164 | |
| 165 | // Required for unit tests to set to known state |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 166 | function resetSid() { |
| 167 | sid = 0; |
Simon Hunt | 970e7fd | 2015-01-22 17:46:28 -0800 | [diff] [blame] | 168 | } |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 169 | function resetState() { |
| 170 | webSockOpts = undefined; |
| 171 | ws = null; |
| 172 | wsUp = false; |
| 173 | host = undefined; |
| 174 | url = undefined; |
| 175 | pendingEvents = []; |
| 176 | handlers = {}; |
| 177 | sid = 0; |
| 178 | clusterNodes = []; |
| 179 | clusterIndex = -1; |
| 180 | connectRetries = 0; |
| 181 | openListeners = {}; |
| 182 | nextListenerId = 1; |
| 183 | } |
Simon Hunt | 970e7fd | 2015-01-22 17:46:28 -0800 | [diff] [blame] | 184 | |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 185 | // Currently supported opts: |
| 186 | // wsport: web socket port (other than default 8181) |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 187 | // host: if defined, is the host address to use |
| 188 | function createWebSocket(opts, _host_) { |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 189 | var wsport = (opts && opts.wsport) || null; |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 190 | |
Simon Hunt | 8b6d2d4 | 2015-03-11 13:04:52 -0700 | [diff] [blame] | 191 | webSockOpts = opts; // preserved for future calls |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 192 | |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 193 | host = _host_ || $loc.host(); |
| 194 | url = ufs.wsUrl('core', wsport, _host_); |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 195 | |
| 196 | $log.debug('Attempting to open websocket to: ' + url); |
| 197 | ws = wsock.newWebSocket(url); |
| 198 | if (ws) { |
| 199 | ws.onopen = handleOpen; |
| 200 | ws.onmessage = handleMessage; |
| 201 | ws.onclose = handleClose; |
| 202 | } |
| 203 | // Note: Wsock logs an error if the new WebSocket call fails |
Simon Hunt | 2d16fc8 | 2015-03-10 20:19:52 -0700 | [diff] [blame] | 204 | return url; |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 205 | } |
| 206 | |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 207 | // Binds the message handlers to their message type (event type) as |
| 208 | // specified in the given map. Note that keys are the event IDs; values |
| 209 | // are either: |
| 210 | // * the event handler function, or |
| 211 | // * an API object which has an event handler for the key |
| 212 | // |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 213 | function bindHandlers(handlerMap) { |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 214 | var m, |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 215 | dups = []; |
Simon Hunt | 970e7fd | 2015-01-22 17:46:28 -0800 | [diff] [blame] | 216 | |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 217 | if (noHandlersWarn(handlerMap, 'bindHandlers')) { |
| 218 | return null; |
| 219 | } |
| 220 | m = d3.map(handlerMap); |
| 221 | |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 222 | m.forEach(function (eventId, api) { |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 223 | var fn = fs.isF(api) || fs.isF(api[eventId]); |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 224 | if (!fn) { |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 225 | $log.warn(eventId + ' handler not a function'); |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 226 | return; |
Simon Hunt | 970e7fd | 2015-01-22 17:46:28 -0800 | [diff] [blame] | 227 | } |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 228 | |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 229 | if (handlers[eventId]) { |
| 230 | dups.push(eventId); |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 231 | } else { |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 232 | handlers[eventId] = fn; |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 233 | } |
| 234 | }); |
| 235 | if (dups.length) { |
| 236 | $log.warn('duplicate bindings ignored:', dups); |
| 237 | } |
Simon Hunt | 970e7fd | 2015-01-22 17:46:28 -0800 | [diff] [blame] | 238 | } |
| 239 | |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 240 | // Unbinds the specified message handlers. |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 241 | // Expected that the same map will be used, but we only care about keys |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 242 | function unbindHandlers(handlerMap) { |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 243 | var m; |
| 244 | |
| 245 | if (noHandlersWarn(handlerMap, 'unbindHandlers')) { |
| 246 | return null; |
| 247 | } |
| 248 | m = d3.map(handlerMap); |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 249 | |
| 250 | m.forEach(function (eventId) { |
| 251 | delete handlers[eventId]; |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 252 | }); |
| 253 | } |
Simon Hunt | acf410b | 2015-01-23 10:05:48 -0800 | [diff] [blame] | 254 | |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 255 | function addOpenListener(callback) { |
| 256 | var id = nextListenerId++, |
| 257 | cb = fs.isF(callback), |
| 258 | o = { id: id, cb: cb }; |
| 259 | |
| 260 | if (cb) { |
| 261 | openListeners[id] = o; |
| 262 | } else { |
| 263 | $log.error('WSS.addOpenListener(): callback not a function'); |
| 264 | o.error = 'No callback defined'; |
| 265 | } |
| 266 | return o; |
| 267 | } |
| 268 | |
| 269 | function removeOpenListener(lsnr) { |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 270 | var id = fs.isO(lsnr) && lsnr.id, |
| 271 | o; |
| 272 | if (!id) { |
| 273 | $log.warn('WSS.removeOpenListener(): invalid listener', lsnr); |
| 274 | return null; |
| 275 | } |
| 276 | o = openListeners[id]; |
| 277 | |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 278 | if (o) { |
| 279 | delete openListeners[id]; |
| 280 | } |
| 281 | } |
| 282 | |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 283 | // Formulates an event message and sends it via the web-socket. |
| 284 | // If the websocket is not up yet, we store it in a pending list. |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 285 | function sendEvent(evType, payload) { |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 286 | var ev = { |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 287 | event: evType, |
| 288 | sid: ++sid, |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 289 | payload: payload || {} |
| 290 | }; |
| 291 | |
| 292 | if (wsUp) { |
| 293 | _send(ev); |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 294 | } else { |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 295 | pendingEvents.push(ev); |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 296 | } |
| 297 | } |
| 298 | |
| 299 | |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 300 | // ============================ |
| 301 | // ===== Definition of module |
Simon Hunt | 584122a | 2015-01-21 15:32:40 -0800 | [diff] [blame] | 302 | angular.module('onosRemote') |
Simon Hunt | bb920fd | 2015-01-22 17:06:32 -0800 | [diff] [blame] | 303 | .factory('WebSocketService', |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 304 | ['$log', '$location', 'FnService', 'UrlFnService', 'WSock', |
Simon Hunt | ab34ecb | 2015-12-11 13:14:48 -0800 | [diff] [blame] | 305 | 'VeilService', 'LoadingService', |
Simon Hunt | bb920fd | 2015-01-22 17:06:32 -0800 | [diff] [blame] | 306 | |
Simon Hunt | ab34ecb | 2015-12-11 13:14:48 -0800 | [diff] [blame] | 307 | function (_$log_, _$loc_, _fs_, _ufs_, _wsock_, _vs_, _ls_) { |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 308 | $log = _$log_; |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 309 | $loc = _$loc_; |
| 310 | fs = _fs_; |
| 311 | ufs = _ufs_; |
| 312 | wsock = _wsock_; |
| 313 | vs = _vs_; |
Simon Hunt | ab34ecb | 2015-12-11 13:14:48 -0800 | [diff] [blame] | 314 | ls = _ls_; |
Simon Hunt | 1e4a001 | 2015-01-21 11:36:08 -0800 | [diff] [blame] | 315 | |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 316 | bindHandlers(builtinHandlers); |
Thomas Vachuska | b6acc7b | 2015-03-11 09:11:21 -0700 | [diff] [blame] | 317 | |
Simon Hunt | 1e4a001 | 2015-01-21 11:36:08 -0800 | [diff] [blame] | 318 | return { |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 319 | resetSid: resetSid, |
Bri Prebilic Cole | 6ed04eb | 2015-04-27 16:26:03 -0700 | [diff] [blame] | 320 | resetState: resetState, |
Thomas Vachuska | 329af53 | 2015-03-10 02:08:33 -0700 | [diff] [blame] | 321 | createWebSocket: createWebSocket, |
| 322 | bindHandlers: bindHandlers, |
| 323 | unbindHandlers: unbindHandlers, |
Simon Hunt | 3b9ad04d | 2015-03-11 15:26:02 -0700 | [diff] [blame] | 324 | addOpenListener: addOpenListener, |
| 325 | removeOpenListener: removeOpenListener, |
Simon Hunt | 412adc8 | 2015-12-11 15:56:20 -0800 | [diff] [blame] | 326 | sendEvent: sendEvent, |
| 327 | isConnected: function () { return wsUp; } |
Simon Hunt | 1e4a001 | 2015-01-21 11:36:08 -0800 | [diff] [blame] | 328 | }; |
Simon Hunt | 20207df | 2015-03-10 18:30:14 -0700 | [diff] [blame] | 329 | } |
| 330 | ]); |
Simon Hunt | 1e4a001 | 2015-01-21 11:36:08 -0800 | [diff] [blame] | 331 | |
| 332 | }()); |