<commit_before># MQFacebookManager

[![Build Status](https://travis-ci.org/mobile-web-messaging/MQTTKit.svg?branch=master)](https://travis-ci.org/mobile-web-messaging/MQFacebookManager)

MQFacebookManager is a modern event-driven Objective-C library.

An iOS application using MQFacebookManager is available at [MQFacebookManager](https://github.com/quangmv/MQFacebookManager).

## Installation Using CocoaPods

On your ```Podfile``` add this project:

```
...
pod 'MQFacebookManager'
...
```

For the first time, run ```pod install```, if you are updating the project invoke ```pod update```.

## Usage

Import the `FacebookManager.h` header file

```objc
#import <FacebookManager.h>
```

### Send a Message

```objc
// create the client with a unique client ID
NSString *clientID = ...
MQTTClient *client = [[MQTTClient alloc] initWithClientId:clientID];

// connect to the MQTT server
[self.client connectToHost:@"iot.eclipse.org" 
         completionHandler:^(NSUInteger code) {
    if (code == ConnectionAccepted) {
        // when the client is connected, send a MQTT message
        [self.client publishString:@"Hello, MQTT"
                           toTopic:@"/MQTTKit/example"
                           withQos:AtMostOnce
                            retain:NO
                 completionHandler:^(int mid) {
            NSLog(@"message has been delivered");
        }];
    }
}];

```

### Subscribe to a Topic and Receive Messages

```objc

// define the handler that will be called when MQTT messages are received by the client
[self.client setMessageHandler:^(MQTTMessage *message) {
    NSString *text = [message.payloadString];
    NSLog(@"received message %@", text);
}];

// connect the MQTT client
[self.client connectToHost:@"iot.eclipse.org"
         completionHandler:^(MQTTConnectionReturnCode code) {
    if (code == ConnectionAccepted) {
        // when the client is connected, subscribe to the topic to receive message.
        [self.client subscribe:@"/MQTTKit/example"
         withCompletionHandler:nil];
    }
}];
```

### Disconnect from the server

```objc
[self.client disconnectWithCompletionHandler:^(NSUInteger code) {
    // The client is disconnected when this completion handler is called
    NSLog(@"MQTT client is disconnected");
}];
```
## Authors

* [<NAME>](http://jmesnil.net/)

[mqtt]: http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html
<commit_msg>Adding example project<commit_after># MQFacebookManager

An iOS application using MQFacebookManager is available at [Example](https://github.com/quangmv/MQFacebookManager/tree/master/Example).

## Installation Using CocoaPods

On your ```Podfile``` add this project:

```
...
pod 'MQFacebookManager'
...
```

For the first time, run ```pod install```, if you are updating the project invoke ```pod update```.

## Usage

Import the `FacebookManager.h` header file

```objc
#import <FacebookManager.h>
```

### Request permissions blocks

```objc
// request permissions block
[FacebookManager requestPermissions:@[@"public_profile"] success:^{
// success
// do somethings
}];

```

### Request for Me blocks

```objc

// request for me informations
[FacebookManager requestForMeSuccess:^(id result) {
NSLog(@"%@",result);
}];
```

### Share link or message

```objc
[FacebookManager shareMessage:@"message" link:@"link"];
```

### Likes website url

```objc
[FacebookManager likeUrl:@"https://www.google.com/"];
```

### Post video

```objc
[FacebookManager postVideo:data Title:@"title" andDescription:@"description"];
```

## Authors

* [QuangMV](https://twitter.com/quangmv)
{'fraction_non_alphanumeric': 0.14444753687726133, 'fraction_numerical': 0.0005566379070414695, 'mean_word_length': 3.896457765667575, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 6, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '550746', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1054, 'n_words': 290}