https://github.com/facebook/SocketRocket
Connection Failed:Error Domain=SRWebSocketErrorDomain
Code=2133 "Invalid Sec-WebSocket-Accept response."
Sec-WebSocket-Accept response.}
解决方法:URL后面添加ws。
//初始化
self.webSocket = [[SRWebSocket alloc] initWithURL:URL];
self.webSocket.delegate = self;
[self.webSocket open];
常用代理方法
- (void)webSocketDidOpen:(SRWebSocket *)webSocket;
- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error;
- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessageWithString:(NSString *)string;
- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:
(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;