jetfire是使用Objective-C实现了iOS和OSX的Websockets(RFC6455)。
同时还有个Swift版本的:starscream
特性:
符合所有基础的Autobah测试套件.
非阻塞。所有都在后台运行
简单的委托模式设计
TLS/WSS支持
几百行简单的LOC代码
示例:
/////////////////////////////////////////////////////////////////////////////-(void)websocketDidCoect:(JFWebSocket*)socket{ NSLog(@"websocket is coected");}/////////////////////////////////////////////////////////////////////////////-(void)websocketDidDiscoect:(JFWebSocket*)socket error:(NSError*)error{ NSLog(@"websocket is discoected: %@",[error localizedDescriptio]);}/////////////////////////////////////////////////////////////////////////////-(void)websocket:(JFWebSocket*)socket didReceiveMessage:(NSStrig*)strig{ NSLog(@"got some text: %@",strig); dispatch_asyc(dispatch_get_mai_queue(),^{ //do some UI work });}/////////////////////////////////////////////////////////////////////////////-(void)websocket:(JFWebSocket*)socket didReceiveData:(NSData*)data{ NSLog(@"got some biary data: %d",data.legth);}
评论