iOS client lib for pomelo
Objective-C
Switch branches/tags
Nothing to show
Latest commit 1aa285b Mar 6, 2013 @numbcoder numbcoder fix spell error
Permalink
Failed to load latest commit information.
LICENSE add license Dec 20, 2012
Pomelo.h new callback api Dec 29, 2012
Pomelo.m new callback api Dec 29, 2012
PomeloProtocol.h change events api Dec 25, 2012
PomeloProtocol.m change events api Dec 25, 2012
README.md fix spell error Mar 6, 2013

README.md

#Pomelo iOS client

The iOS client library for Pomelo

A demo exists for this library.

##Dependencies

##Installation

  1. make sure you have installed the dependencies
  2. then just add the Pomelo.h, Pomelo.m, PomeloProtocol.h, pomeloProtocol.m files to your project.

##Usage

Pomelo API

- (id)initWithDelegate:(id<PomeloDelegate>)delegate;
- (void)connectToHost:(NSString *)host onPort:(NSInteger)port;
- (void)connectToHost:(NSString *)host onPort:(NSInteger)port withCallback:(PomeloCallback)callback;
- (void)connectToHost:(NSString *)host onPort:(NSInteger)port withParams:(NSDictionary *)params;
- (void)disconnect;
- (void)disconnectWithCallback:(PomeloCallback)callback;

- (void)requestWithRoute:(NSString *)route andParams:(NSDictionary *)params andCallback:(PomeloCallback)callback;
- (void)notifyWithRoute:(NSString *)route andParams:(NSDictionary *)params;
- (void)onRoute:(NSString *)route withCallback:(PomeloCallback)callback;
- (void)offRoute:(NSString *)route;

connect to the pomelo server

Pomelo *pomelo = [[Pomelo alloc] initWithDelegate:self];
[pomelo connectToHost:@"localhost" onPort:3000];

request

PomeloCallback cb = ^(id argsData) {
    // do something with response
};
[pomelo requestWithRoute:@"gate.gateHandler.queryEntry" andParams:data andCallback:cb];

notify

[pomelo notifyWithRoute:@"chat.chatHandler.send" andParams:data];

bind event

[pomelo onRoute:@"onChat" withCallback:^(NSDictionary *data){
    // do something...
}];

unbind event

[pomelo offRoute:@"onChat"];

##License (The MIT License)

Copyright (c) 2012-2013 NetEase, Inc. and other contributors

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.