ARDSignalingChannel.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. #import <Foundation/Foundation.h>
  11. #import "ARDSignalingMessage.h"
  12. typedef NS_ENUM(NSInteger, ARDSignalingChannelState) {
  13. // State when disconnected.
  14. kARDSignalingChannelStateClosed,
  15. // State when connection is established but not ready for use.
  16. kARDSignalingChannelStateOpen,
  17. // State when connection is established and registered.
  18. kARDSignalingChannelStateRegistered,
  19. // State when connection encounters a fatal error.
  20. kARDSignalingChannelStateError
  21. };
  22. @protocol ARDSignalingChannel;
  23. @protocol ARDSignalingChannelDelegate <NSObject>
  24. - (void)channel:(id<ARDSignalingChannel>)channel didChangeState:(ARDSignalingChannelState)state;
  25. - (void)channel:(id<ARDSignalingChannel>)channel didReceiveMessage:(ARDSignalingMessage *)message;
  26. @end
  27. @protocol ARDSignalingChannel <NSObject>
  28. @property(nonatomic, readonly) NSString *roomId;
  29. @property(nonatomic, readonly) NSString *clientId;
  30. @property(nonatomic, readonly) ARDSignalingChannelState state;
  31. @property(nonatomic, weak) id<ARDSignalingChannelDelegate> delegate;
  32. // Registers the channel for the given room and client id.
  33. - (void)registerForRoomId:(NSString *)roomId clientId:(NSString *)clientId;
  34. // Sends signaling message over the channel.
  35. - (void)sendMessage:(ARDSignalingMessage *)message;
  36. @end