Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Node binary websocket streaming made easy for iOS

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time


Frameworks and Sources


Include StreamClient.h:

#import "StreamClient.h"

Create a client to a websocket, set to an instance variable then set a delegate and open:

- (void)viewWillAppear:(BOOL)animated {
    _client = [StreamClient clientWithAddress:[NSURL URLWithString:@"ws://"]];
    _client.delegate = self;
    [_client openClient];

Abide to StreamClientDelegate Protocol:

@protocol StreamClientDelegate <NSObject>
- (void)streamCreated: (BinaryStream *)stream withMeta: (id)meta;
- (void)clientOpened;
- (void)clientClosedWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;
- (void)clientErred: (NSError *)error;

When handling created streams, a delegate should follow the StreamDelegate protocol:

@protocol StreamDelegate <NSObject>
- (void)streamGotData: (id)data;
- (void)streamGotError: (NSError *)error;
- (void)streamEnded;

Create, write to, listen to, end, and pipe streams as you please. Use the FileReadStream and FileWriteStream which are file interfaces following the same protocols as BinaryStreams:

@protocol WriteStream <NSObject>
- (void)write: (id)data;
- (void)end;
- (void)pause;  //TODO
- (void)resume; //TODO

@protocol ReadStream <NSObject>
- (void)open;
- (void)pipe: (NSObject<WriteStream> *)destination;
- (void)pause;  //TODO
- (void)resume; //TODO
Something went wrong with that request. Please try again.