2 * Copyright 2017 Google
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #import <Foundation/Foundation.h>
19 typedef NS_ENUM(NSUInteger, FIRMessagingSecureSocketState){
20 kFIRMessagingSecureSocketNotOpen = 0,
21 kFIRMessagingSecureSocketOpening,
22 kFIRMessagingSecureSocketOpen,
23 kFIRMessagingSecureSocketClosing,
24 kFIRMessagingSecureSocketClosed,
25 kFIRMessagingSecureSocketError
28 @class FIRMessagingSecureSocket;
30 @protocol FIRMessagingSecureSocketDelegate<NSObject>
32 - (void)secureSocket:(FIRMessagingSecureSocket *)socket
33 didReceiveData:(NSData *)data
35 - (void)secureSocket:(FIRMessagingSecureSocket *)socket
36 didSendProtoWithTag:(int8_t)tag
37 rmqId:(NSString *)rmqId;
38 - (void)secureSocketDidConnect:(FIRMessagingSecureSocket *)socket;
39 - (void)didDisconnectWithSecureSocket:(FIRMessagingSecureSocket *)socket;
44 * This manages the input/output streams connected to the MCS server. Used to receive data from
45 * the server and send to it over the wire.
47 @interface FIRMessagingSecureSocket : NSObject
49 @property(nonatomic, readwrite, weak) id<FIRMessagingSecureSocketDelegate> delegate;
50 @property(nonatomic, readonly, assign) FIRMessagingSecureSocketState state;
52 - (void)connectToHost:(NSString *)host port:(NSUInteger)port onRunLoop:(NSRunLoop *)runLoop;
54 - (void)sendData:(NSData *)data withTag:(int8_t)tag rmqId:(NSString *)rmqId;