2011-03-05 15:02:50 -05:00
2011-03-05 15:02:50 -05:00
2011-03-05 14:29:30 -05:00
2011-03-05 14:29:30 -05:00
2011-03-05 15:02:50 -05:00

= FayeObjC

A simple Objective-C client library for the Faye publish-subscribe messaging server. FayeObjC is implementing on top of the zimt Objective-C web socket library and will work on both Mac and iPhone projects.

= Building the library

Using it in a Mac project:

Using FayeObjC is as simple as adding the FayeObjC source folder to your Xcode project directory and then adding it to the project.  FayeObjc has a couple of dependencies the one is the YAJL JSON parser, it also requires the import of the CoreServices.framework on Mac OS X which is used by AsyncSocket (part of the zimt websocket library).

Add the CoreServices.framework to your project by right clicking on Linked Frameworks in the Project and selecting Add->Existing Frameworks...

Setting up YAJL for Mac:

You can get the YAJL.framework from: https://github.com/gabriel/yajl-objc
Getting YAJL to build:
* Copy `YAJL.framework` to your project directory (maybe in MyProject/Frameworks/.)
* Add the `YAJL.framekwork` files (from MyProject/Frameworks/) to your target. It should be visible as a `Linked Framework` in the target. 
* Under Build Settings, add `@loader_path/../Frameworks` to `Runpath Search Paths` 
* Add `New Build Phase` | `New Copy Files Build Phase`. 
	* Change the Destination to `Frameworks`.
	* Drag `YAJL.framework` into the the build phase
	* Make sure the copy phase appears before any `Run Script` phases

Using it in an iPhone project:

Using FayeObjC is as simple as adding the FayeObjC source folder to your Xcode project directory and then adding it to the project.  FayeObjc has a couple of dependencies the one is the YAJL JSON parser, it also requires the import of the CFNetwork.framework on iOS which is used by AsyncSocket (part of the zimt websocket library).

Setting up YAJL for iPhone:

You can get the YAJL.framework from: https://github.com/gabriel/yajl-objc
Getting YAJL to build:
* Add `YAJLiOS.framework` to your project.
* Add the frameworks to `Linked Libraries`:
  * `YAJLiOS.framework`
  * `CoreGraphics.framework`
  * `Foundation.framework`
  * `UIKit.framework`
* Under `Framework Search Paths` make sure the (parent) directory to `YAJLiOS.framework` is listed.
* Under `Other Linker Flags` in your target, add `-ObjC` and `-all_load`

Add the CFNetwork.framework to your project by right clicking on Linked Frameworks in the Project and selecting Add->Existing Frameworks...

== Working with the library

Initialize a Client:
  // import the client
  #import "FayeClient.h"

  // init the FayeClient with a server and channel to subscribe to
  FayeClient *faye = [[FayeClient alloc] initWithURLString:@"ws://localhost:8000/faye" channel:@"/chat"];
  faye.delegate = self; // ensure that you implement the FayeClientDelegate functions
  // connect to the server
  [faye connectToServer];
  
Implement the FayeClientDelegate:
  - (void) messageReceived:(NSDictionary *)messageDict {
    DLog(@"message received");
    // do something useful with the message dictionary    
  }

  - (void)connectedToServer {
    // Faye connection established    
  }

  - (void)disconnectedFromServer {
    // Faye disconnected
  }

Example Project:

Included in the repository is a sample XCode project for Mac that provides a simple client application for interacting with Faye servers.  Try it out and have a look at the code for an illustration on the usage of the library.

The fayeMac sample project allows you to test out any Faye server.

= Faye
Faye is a simple JSON based Pub-Sub server which has support for node.js and Ruby (using Rack).

Check out the Faye project here:
* http://faye.jcoglan.com


== License

(The MIT License)

Copyright (c) 2011 Paul Crawford

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Description
No description provided
Readme 1.7 MiB
Languages
Objective-C 97.1%
C 2.8%