Latest 0.0.8
Homepage https://github.com/travisjeffery/TRVSEventSource
License MIT
Platforms ios 7.0, osx 10.9, requires ARC
Authors

Server-sent events EventSource implementation in ObjC for iOS and OS X using NSURLSession.

Usage

TRVSEventSource *eventSource = [[TRVSEventSource alloc] initWithURL:URL];
eventSource.delegate = self;

[eventSource addListenerForEvent:@"message" usingEventHandler:^(TRVSServerSentEvent *event, NSError *error) {
    NSDictionary *JSON = [NSJSONSerialization JSONObjectWithData:event.data options:0 error:NULL];
    Message *message = [Message messageWithJSON:JSON];
}];

[eventSource open];

Local test server

Run the following to have a local server streaming events named message:

node TRVSEventSourceTests/server.js

❯ curl 127.0.0.1:8000
event: message
data: {"id": 1, "body":"1381466575460", "author_id": 1, "conversation_id": 1}

event: message
data: {"id": 2, "body":"1381466577463", "author_id": 1, "conversation_id": 1}

Latest podspec

{
    "name": "TRVSEventSource",
    "version": "0.0.8",
    "summary": "Server-sent events EventSource implementation in ObjC for iOS and OS X using NSURLSession.",
    "homepage": "https://github.com/travisjeffery/TRVSEventSource",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "Travis Jeffery": "[email protected]"
    },
    "platforms": {
        "ios": "7.0",
        "osx": "10.9"
    },
    "source": {
        "git": "https://github.com/travisjeffery/TRVSEventSource.git",
        "tag": "0.0.8"
    },
    "source_files": [
        "TRVSEventSource",
        "TRVSEventSource/**/*.{h,m}"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This