FireNio 构建通讯项目的异步 io 框架开源项目

我要开发同款
匿名用户2019年05月24日
31阅读
开发技术Java
所属分类高性能网络开发库、程序开发
授权协议Apache

作品详情

FireNioProject

FireNio是基于javanio开发的一款可快速构建网络通讯项目的异步IO框架,其以简单易用的API和优良的性能深受开发者喜爱。

项目特色支持协议扩展,已知的扩展协议有:LengthValue协议,支持传输文本数据HTTP1.1协议(lite),示例: https://www.firenio.com/WebSocket协议,示例: https://www.firenio.com/web-socket/chat/index.htmlProtobase(自定义协议),支持传输文本或二进制数据轻松实现断线重连(轻松实现心跳机制)支持SSL(jdkssl,openssl)压力测试tfbbenchmark快速入门Maven引用:<dependency><groupId>com.firenio</groupId><artifactId>firenio-all</artifactId><version>1.2.1</version></dependency>SimpleServer:publicstaticvoidmain(String[]args)throwsException{IoEventHandleeventHandleAdaptor=newIoEventHandle(){@Overridepublicvoidaccept(Channelch,Framef)throwsException{Stringtext=f.getStringContent();f.setContent(ch.allocate());f.write("yesserveralreadyacceptyourmessage:",ch);f.write(text,ch);ch.writeAndFlush(f);}};ChannelAcceptorcontext=newChannelAcceptor(8300);context.addChannelEventListener(newLoggerChannelOpenListener());context.setIoEventHandle(eventHandleAdaptor);context.addProtocolCodec(newLengthValueCodec());context.bind();}SimpleClient:publicstaticvoidmain(String[]args)throwsException{ChannelConnectorcontext=newChannelConnector("127.0.0.1",8300);IoEventHandleeventHandle=newIoEventHandle(){@Overridepublicvoidaccept(Channelch,Framef)throwsException{System.out.println();System.out.println("____________________"+f.getStringContent());System.out.println();context.close();}};context.setIoEventHandle(eventHandle);context.addChannelEventListener(newLoggerChannelOpenListener());context.addProtocolCodec(newLengthValueCodec());Channelch=context.connect(3000);LengthValueFrameframe=newLengthValueFrame();frame.setString("helloserver!");ch.writeAndFlush(frame);}更多样例详见{firenio-test}演示及用例HTTPDemo:https://www.firenio.com/index.htmlWebSocket聊天室Demo:https://www.firenio.com/web-socket/chat/index.html(后端基于firenio,前端基于:https://github.com/socketio/socket.io/ )WebSocket小蝌蚪Demo:https://www.firenio.com/web-socket/rumpetroll/index.html(后端基于firenio,前端基于:https://github.com/danielmahal/Rumpetroll )License

FireNioisreleasedunderthe ApacheLicense2.0.

查看全文
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论