blob: 02d71b522f71e528cb02ca248a87b8e81332ba42 [file] [log] [blame]
Simon Hunt1e4a0012015-01-21 11:36:08 -08001/*
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/*
Thomas Vachuska329af532015-03-10 02:08:33 -070018 DEPRECATED: to be deleted
Simon Hunt1e4a0012015-01-21 11:36:08 -080019 ONOS GUI -- Remote -- Web Socket Event Service
20 */
21(function () {
22 'use strict';
23
Simon Hunt3b0916b2015-01-23 11:06:56 -080024 var sid = 0;
25
Simon Hunt1e4a0012015-01-21 11:36:08 -080026 angular.module('onosRemote')
Simon Hunt3b0916b2015-01-23 11:06:56 -080027 .factory('WsEventService', [function () {
28
29 function sendEvent(ws, evType, payload) {
30 var p = payload || {};
31
32 ws.send({
33 event: evType,
34 sid: ++sid,
35 payload: p
36 });
37 }
38
39 function resetSid() {
40 sid = 0;
41 }
42
Simon Hunt1e4a0012015-01-21 11:36:08 -080043 return {
Simon Hunt3b0916b2015-01-23 11:06:56 -080044 sendEvent: sendEvent,
45 resetSid: resetSid
Simon Hunt1e4a0012015-01-21 11:36:08 -080046 };
47 }]);
48
49}());