ALNetworkInterface - RITAccess/accessmath GitHub Wiki

This is a singleton that lives in the application delegate as server. This interface handles communication between the app and the LectureConnect server. Follow these guidelines for using this interface for getting access to streams and downloading lectures.

Connecting to the server

First you need to get a reference to the interface. You can access this from the application delegate.

AccessLectureAppDelegate *app = [[UIApplication sharedApplication] delegate];
ALNetworkInterface *streamServer = app.server;

You can set the connection URL by setting the property on the server. The URL is in string format and the port and protocol are defined by the interface.

[streamServer setConnectionURL:@"localhost"];

To download a lecture from the server simple use getFullLecture:completion:.

[streamServer getFullLecture:@"Lecture Name" completion:^(Lecture *lecture, BOOL found) {
    if (found)
        // Use lecture
}];

To access a stream you first need to set up a delegate to receive updates from the server. Follow the <LectureStreaming> protocol.

@interface MyClass : NSObject <LectureStreaming>

@end

@implementation

- (void)didRecieveUpdate:(id)data
{
    // Update UI and local storage
}

@end

To begin updates, make a request to the server to join a stream

[streamServer setDelegate:self];
[steamServer requestAccessToLectureStream:@"Name of Lecture"];