Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 651cfb6f5d
Fetching contributors…

Cannot retrieve contributors at this time

47 lines (36 sloc) 1.013 kB
//
// PKWebSocketMessage.m
// PKWebSocket
//
// Created by Pavel Kunc on 22/04/2012.
// Copyright (c) 2012 Pavel Kunc. All rights reserved.
//
#import "PKWebSocketMessage.h"
@interface PKWebSocketMessage ()
@end
@implementation PKWebSocketMessage
@synthesize data = _data;
@synthesize string = _string;
@synthesize type = _type;
+ (id)messageWithData:(NSData *)data {
return [[[self class] alloc] initWithContent:data type:PKWebSocketMessageTypeData];
}
+ (id)messageWithString:(NSString *)string {
return [[[self class] alloc] initWithContent:string type:PKWebSocketMessageTypeText];
}
- (id)initWithContent:(id)aContent type:(PKWebSocketMessageType)aType {
self = [super init];
if (self != nil) {
self->_type = aType;
if (aType == PKWebSocketMessageTypeData) {
self->_data = aContent;
} else {
self->_string = aContent;
}
}
return self;
}
- (BOOL)isBinary {
return _type == PKWebSocketMessageTypeData;
}
@end
Jump to Line
Something went wrong with that request. Please try again.