1*d9f75844SAndroid Build Coastguard Worker /* 2*d9f75844SAndroid Build Coastguard Worker * Copyright 2014 The WebRTC Project Authors. All rights reserved. 3*d9f75844SAndroid Build Coastguard Worker * 4*d9f75844SAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license 5*d9f75844SAndroid Build Coastguard Worker * that can be found in the LICENSE file in the root of the source 6*d9f75844SAndroid Build Coastguard Worker * tree. An additional intellectual property rights grant can be found 7*d9f75844SAndroid Build Coastguard Worker * in the file PATENTS. All contributing project authors may 8*d9f75844SAndroid Build Coastguard Worker * be found in the AUTHORS file in the root of the source tree. 9*d9f75844SAndroid Build Coastguard Worker */ 10*d9f75844SAndroid Build Coastguard Worker 11*d9f75844SAndroid Build Coastguard Worker #import <Foundation/Foundation.h> 12*d9f75844SAndroid Build Coastguard Worker 13*d9f75844SAndroid Build Coastguard Worker #import "ARDSignalingChannel.h" 14*d9f75844SAndroid Build Coastguard Worker 15*d9f75844SAndroid Build Coastguard Worker // Wraps a WebSocket connection to the AppRTC WebSocket server. 16*d9f75844SAndroid Build Coastguard Worker @interface ARDWebSocketChannel : NSObject <ARDSignalingChannel> 17*d9f75844SAndroid Build Coastguard Worker 18*d9f75844SAndroid Build Coastguard Worker - (instancetype)initWithURL:(NSURL *)url 19*d9f75844SAndroid Build Coastguard Worker restURL:(NSURL *)restURL 20*d9f75844SAndroid Build Coastguard Worker delegate:(id<ARDSignalingChannelDelegate>)delegate; 21*d9f75844SAndroid Build Coastguard Worker 22*d9f75844SAndroid Build Coastguard Worker // Registers with the WebSocket server for the given room and client id once 23*d9f75844SAndroid Build Coastguard Worker // the web socket connection is open. 24*d9f75844SAndroid Build Coastguard Worker - (void)registerForRoomId:(NSString *)roomId clientId:(NSString *)clientId; 25*d9f75844SAndroid Build Coastguard Worker 26*d9f75844SAndroid Build Coastguard Worker // Sends message over the WebSocket connection if registered, otherwise POSTs to 27*d9f75844SAndroid Build Coastguard Worker // the web socket server instead. 28*d9f75844SAndroid Build Coastguard Worker - (void)sendMessage:(ARDSignalingMessage *)message; 29*d9f75844SAndroid Build Coastguard Worker 30*d9f75844SAndroid Build Coastguard Worker @end 31*d9f75844SAndroid Build Coastguard Worker 32*d9f75844SAndroid Build Coastguard Worker // Loopback mode is used to cause the client to connect to itself for testing. 33*d9f75844SAndroid Build Coastguard Worker // A second web socket connection is established simulating the other client. 34*d9f75844SAndroid Build Coastguard Worker // Any messages received are sent back to the WebSocket server after modifying 35*d9f75844SAndroid Build Coastguard Worker // them as appropriate. 36*d9f75844SAndroid Build Coastguard Worker @interface ARDLoopbackWebSocketChannel : ARDWebSocketChannel 37*d9f75844SAndroid Build Coastguard Worker 38*d9f75844SAndroid Build Coastguard Worker - (instancetype)initWithURL:(NSURL *)url restURL:(NSURL *)restURL; 39*d9f75844SAndroid Build Coastguard Worker 40*d9f75844SAndroid Build Coastguard Worker @end 41