• 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 didChangeState:(ARDSignalingChannelState)state;
30 
31 - (void)channel:(id<ARDSignalingChannel>)channel didReceiveMessage:(ARDSignalingMessage *)message;
32 
33 @end
34 
35 @protocol ARDSignalingChannel <NSObject>
36 
37 @property(nonatomic, readonly) NSString *roomId;
38 @property(nonatomic, readonly) NSString *clientId;
39 @property(nonatomic, readonly) ARDSignalingChannelState state;
40 @property(nonatomic, weak) id<ARDSignalingChannelDelegate> delegate;
41 
42 // Registers the channel for the given room and client id.
43 - (void)registerForRoomId:(NSString *)roomId clientId:(NSString *)clientId;
44 
45 // Sends signaling message over the channel.
46 - (void)sendMessage:(ARDSignalingMessage *)message;
47 
48 @end
49