blob: 396b117b1796478ea582aee148b3b8edfeff0bf1 [file] [log] [blame]
Donald E Curtisa8736442015-08-05 15:48:13 -07001/*
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
15typedef 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
Yves Gerey665174f2018-06-19 15:03:05 +020029- (void)channel:(id<ARDSignalingChannel>)channel didChangeState:(ARDSignalingChannelState)state;
Donald E Curtisa8736442015-08-05 15:48:13 -070030
Yves Gerey665174f2018-06-19 15:03:05 +020031- (void)channel:(id<ARDSignalingChannel>)channel didReceiveMessage:(ARDSignalingMessage *)message;
Donald E Curtisa8736442015-08-05 15:48:13 -070032
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.
Yves Gerey665174f2018-06-19 15:03:05 +020043- (void)registerForRoomId:(NSString *)roomId clientId:(NSString *)clientId;
Donald E Curtisa8736442015-08-05 15:48:13 -070044
45// Sends signaling message over the channel.
46- (void)sendMessage:(ARDSignalingMessage *)message;
47
48@end