• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2014 The WebRTC Project Authors. All rights reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #import <Foundation/Foundation.h>
12 
13 #import "ARDSignalingMessage.h"
14 
15 typedef NS_ENUM(NSInteger, ARDSignalingChannelState) {
16   // State when disconnected.
17   kARDSignalingChannelStateClosed,
18   // State when connection is established but not ready for use.
19   kARDSignalingChannelStateOpen,
20   // State when connection is established and registered.
21   kARDSignalingChannelStateRegistered,
22   // State when connection encounters a fatal error.
23   kARDSignalingChannelStateError
24 };
25 
26 @protocol ARDSignalingChannel;
27 @protocol ARDSignalingChannelDelegate <NSObject>
28 
29 - (void)channel:(id<ARDSignalingChannel>)channel
30     didChangeState:(ARDSignalingChannelState)state;
31 
32 - (void)channel:(id<ARDSignalingChannel>)channel
33     didReceiveMessage:(ARDSignalingMessage *)message;
34 
35 @end
36 
37 @protocol ARDSignalingChannel <NSObject>
38 
39 @property(nonatomic, readonly) NSString *roomId;
40 @property(nonatomic, readonly) NSString *clientId;
41 @property(nonatomic, readonly) ARDSignalingChannelState state;
42 @property(nonatomic, weak) id<ARDSignalingChannelDelegate> delegate;
43 
44 // Registers the channel for the given room and client id.
45 - (void)registerForRoomId:(NSString *)roomId
46                  clientId:(NSString *)clientId;
47 
48 // Sends signaling message over the channel.
49 - (void)sendMessage:(ARDSignalingMessage *)message;
50 
51 @end
52 
53