- 浏览: 1498242 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (691)
- linux (207)
- shell (33)
- java (42)
- 其他 (22)
- javascript (33)
- cloud (16)
- python (33)
- c (48)
- sql (12)
- 工具 (6)
- 缓存 (16)
- ubuntu (7)
- perl (3)
- lua (2)
- 超级有用 (2)
- 服务器 (2)
- mac (22)
- nginx (34)
- php (2)
- 内核 (2)
- gdb (13)
- ICTCLAS (2)
- mac android (0)
- unix (1)
- android (1)
- vim (1)
- epoll (1)
- ios (21)
- mysql (3)
- systemtap (1)
- 算法 (2)
- 汇编 (2)
- arm (3)
- 我的数据结构 (8)
- websocket (12)
- hadoop (5)
- thrift (2)
- hbase (1)
- graphviz (1)
- redis (1)
- raspberry (2)
- qemu (31)
- opencv (4)
- socket (1)
- opengl (1)
- ibeacons (1)
- emacs (6)
- openstack (24)
- docker (1)
- webrtc (11)
- angularjs (2)
- neutron (23)
- jslinux (18)
- 网络 (13)
- tap (9)
- tensorflow (8)
- nlu (4)
- asm.js (5)
- sip (3)
- xl2tp (5)
- conda (1)
- emscripten (6)
- ffmpeg (10)
- srt (1)
- wasm (5)
- bert (3)
- kaldi (4)
- 知识图谱 (1)
最新评论
-
wahahachuang8:
我喜欢代码简洁易读,服务稳定的推送服务,前段时间研究了一下go ...
websocket的helloworld -
q114687576:
http://www.blue-zero.com/WebSoc ...
websocket的helloworld -
zhaoyanzimm:
感谢您的分享,给我提供了很大的帮助,在使用过程中发现了一个问题 ...
nginx的helloworld模块的helloworld -
haoningabc:
leebyte 写道太NB了,期待早日用上Killinux!么 ...
qemu+emacs+gdb调试内核 -
leebyte:
太NB了,期待早日用上Killinux!
qemu+emacs+gdb调试内核
ios8,xcode6
https://github.com/square/SocketRocket
https://github.com/killinux/SocketRocket
中的一个文件夹SocketRocket,3包含三个文件
SRWebSocket.h
SRWebSocket.m
SocketRocket-Prefix.pch
copy到工程中
引入4个库
libicucore.dylib,CFNetwork.framework, Security.framework, Foundation.framework
server的例子参考
http://haoningabc.iteye.com/blog/2124605
以上部分参考
参考http://nonocast.cn/websocket-in-objective-c/
参考http://wenxin2009.iteye.com/blog/1707304
有出入
您好,我用了这个方法,发现得不到一样的效果,主要体现为didMessage没打印,然后我去Socket源代码里追踪发现,设好的delegate不知为何到后面变成了空!I need some help, and can you help me?qq:806622085
https://github.com/square/SocketRocket
https://github.com/killinux/SocketRocket
中的一个文件夹SocketRocket,3包含三个文件
SRWebSocket.h
SRWebSocket.m
SocketRocket-Prefix.pch
copy到工程中
// // ViewController.h // TestWebs // // Created by xiao7 on 14-10-9. // Copyright (c) 2014年 killinux. All rights reserved. // #import <UIKit/UIKit.h> #import "SocketRocket/SRWebSocket.h" @interface ViewController : UIViewController<SRWebSocketDelegate> { SRWebSocket *webSocket; } @end
// // ViewController.m // TestWebs // // Created by xiao7 on 14-10-9. // Copyright (c) 2014年 killinux. All rights reserved. // #import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UILabel *showTxt; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. webSocket.delegate = nil; [webSocket close]; webSocket = [[SRWebSocket alloc] initWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"ws://192.168.0.102:8887"]]]; webSocket.delegate = self; [webSocket open]; NSLog(@"open success!"); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (void)webSocketDidOpen:(SRWebSocket *)webSocket; { NSLog(@"Websocket Connected"); self.title = @"Connected!"; } - (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error; { NSLog(@":( Websocket Failed With Error %@", error); webSocket = nil; } - (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message; { NSLog(@"Received \"%@\"", message); self.showTxt.text = message; } - (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean; { NSLog(@"WebSocket closed"); self.title = @"Connection Closed! (see logs)"; webSocket = nil; } @end
引入4个库
libicucore.dylib,CFNetwork.framework, Security.framework, Foundation.framework

server的例子参考
http://haoningabc.iteye.com/blog/2124605
以上部分参考
参考http://nonocast.cn/websocket-in-objective-c/
参考http://wenxin2009.iteye.com/blog/1707304
有出入
评论
1 楼
XieYupeng520
2015-04-08

发表评论
-
websocket直播
2020-05-22 17:59 5821.websocket转发的最简单server 2.h5接收w ... -
openresty聊天室的helloworld
2018-04-22 19:25 889openresty的websocket + redis的sub ... -
openresty websocket
2018-04-18 17:08 1609mac安装openresty brew install o ... -
facebook的socketrocket总结
2018-03-19 13:36 1530最近看了开源的网易的demo https://netease. ... -
nginx代理wss和https
2018-02-27 15:34 3981nginx启用ssl yum install openssl ... -
websocket和tap使用select关联
2016-06-14 22:01 776c语言的socket基础http://haoningabc.i ... -
websocket传传图片
2015-12-25 17:51 7269参考[url]http://www.adobe.com/dev ... -
websocket相关调研 总结帖
2014-12-21 21:53 4093最近把websocket的客户端和服务端使用过的调通的例子总结 ... -
使用websocket,双ibeacons判断方向
2014-12-16 04:08 2055只调用ibeacon的接口 // // ViewCon ... -
ios的页面跳转
2014-12-03 17:30 1402一种通过导航,一种直 ... -
打包ipa
2014-11-14 23:10 8011.新建一个文件夹命名为:Payload 2.将buid生成的 ... -
理解iOS7的Multipeer Connectivity框架
2014-11-13 23:39 940例子可跑 http://www.oschina.net/tr ... -
autobahn的helloworld
2014-11-08 18:36 2793python2.7.8可用,python2.6一样的代码就有问 ... -
ios指南针
2014-10-25 17:06 1111参考http://blog.sina.com.cn/s/blo ... -
linux下编译objectc
2014-10-23 01:24 910编译静态库给ios使用 http://www.tuicool. ... -
ios加速计和陀螺仪
2014-10-22 23:03 1274ios设备中有的加速计可以测量出加速度和重力。陀螺仪可用于确定 ... -
ios websocket server端
2014-10-22 00:07 2229https://github.com/benlodotcom/ ... -
ios仿微信的demo
2014-10-20 00:31 2313610月19日闲的蛋疼,做了个 仿微信的聊天工具 git地址:h ... -
自制微信的ui
2014-10-19 22:28 926参考http://ios.9tech.cn/news/2013 ... -
ios8的tableView使用
2014-10-18 20:34 888ios8是main.storyboard 不是 ...
相关推荐
提到的“GoEasyDemo-Uniapp-Helloworld-2.4”是本指南或者示例代码的名称,它可能是一个基础的演示项目,用来展示如何在Uniapp中使用WebSocket进行实时通讯。虽然具体的代码实现细节不在本文档讨论范围内,但可以...
try response.write("Hello, World!") } server.addRoute(method: .get, uri: "/hello", target: handleRequest) try server.start() ``` 此外,Perfect还支持多种数据库连接,如SQLite、MySQL、PostgreSQL等。你...
request->setRequestData("message=Hello%20World", "application/x-www-form-urlencoded"); httpClient->send(request); request->release(); ``` 2. **WebSocket通信**:对于实时聊天应用,WebSocket是一个更好的...
socket.emit("chat message", "Hello, world!") ``` 如果需要实现实时的私聊功能,我们可以在`emit`时指定接收方的用户ID,服务器端负责将消息转发给指定的用户。 此外,考虑到项目可能需要集成到已有的应用中,...
client.invoke('hello', ['world'], function(result) { console.log('服务器返回:' + result); }); ``` ```java // 服务器端示例 (Java) import hprose.server.HproseHttpServer; public class Server { public ...
2. WebSockets:学习如何使用QT实现双向通信的WebSocket客户端和服务器。 六、数据库访问 1. SQL数据库支持:QT支持SQLite、MySQL、PostgreSQL等多种数据库,讲解如何进行数据库连接、查询、事务处理。 七、QT...
在`HubProxy`上,你可以调用服务器方法,例如`hubProxy.Invoke("Send", "User1", "Hello, world!");`来向服务器发送消息。同时,通过订阅的事件,接收服务器返回的数据。 ### 六、错误处理和断线重连 SignalR提供...