Latest 0.1.0
Homepage https://github.com/anngdev/AISocket
License MIT
Platforms ios 8.0
Authors

Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

AISocket is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "AISocket"

Example


@import AISocket;

[[AISocketManager sharedInstance] connectHost:@"http://192.168.1.10:5000" delegate:self];
[[AISocketManager sharedInstance] listenOnEvent:[AISocketChatData eventName] dataCallback:^AISocketData *(id datas) {
    //Whent data received, you can parse data to AISocketData, then it will be notify to all observers
    AISocketChatData *obj = [[AISocketChatData alloc]initWithString:datas error:nil];
    return obj;
}];

If you need to observer data on other controllers:


[[AISocketManager sharedInstance] addObserver:self onEvent:[AISocketChatData eventName]];

Observer Delegate


- (void)dlgAISocketManager:(AISocketManager*)manager withData:(AISocketData*)data;
- (void)dlgAISocketManager:(AISocketManager*)manager status:(AISocketManagerStatus)status;

Example Socket.io server


var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
io.on('connection', function(socket){
    console.log('new connection');
    socket.on('chatmessage', function(msg,fn){
        fn('ack');
        console.log(msg);
        io.emit('chatmessage', msg);
    });
});

http.listen(5000, function(){
console.log('listening on *: 5000');
});

Author

An Nguyen, [email protected]

License

AISocket is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "AISocket",
    "version": "0.1.0",
    "summary": "A short description of AISocket.",
    "homepage": "https://github.com/anngdev/AISocket",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "An Nguyen": "[email protected]"
    },
    "source": {
        "git": "https://github.com/anngdev/AISocket.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "AISocket/Classes/**/*"
}

Pin It on Pinterest

Share This