All Projects → hden → SocketIO.JSCore

hden / SocketIO.JSCore

Licence: MIT license
SocketIO v1.0.x via JavaScriptCore

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

SocketIO.JSCore

SocketIO v1.0.x via JavaScriptCore

Why?

Socket.IO v1.0.0 is a major refactoring of the popular real-time framework. Unfortunatelly the communication protocal has changed drastically, thus most of the existing obj-c library won't work with v1.0.x.

This project is aimed for a obj-c bridge to the official framework via JavaScriptCore.

Design

------------------------------
|      socket.io obj-c       |
------------------------------
            ⬆ ⬇
------------------------------
| UIWebView + JavaScriptCore |
------------------------------
            ⬆ ⬇
------------------------------
|    socket.io JavaScript    |
------------------------------

Installation

platform :ios, '7.0'
pod 'SocketIO'

Usage

#import "SocketIO.h"

// This library is heavily inspired by the event emitter API of the official client
// Both SocketIO and Socket class are event emitter.
SocketIO *io = [[SocketIO alloc] init];

[io once:@"ready" listener:^{
    Socket *socket = [io of:@"http://localhost:8000" and:@{}];
    [socket once:@"hi" listener:^{
        // recieved response from server
    }];
    [socket emit:@"hi", nil];

    [socket emit:@"giveMeDataViaAck", @{@"test": @true}, ^(id *data) {
        // got response
    }, nil];
}];

See test suite for more code samples.

Further Readings

Development

cd Test
npm install
pod install
open ../SocketIO.xcworkspace
npm start

Licence

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].