Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/FireNio/firenio
π³π³An easy of use io framework project based on java nio&epoll
https://github.com/FireNio/firenio
http java java-nio nio protocol websocket
Last synced: 3 months ago
JSON representation
π³π³An easy of use io framework project based on java nio&epoll
- Host: GitHub
- URL: https://github.com/FireNio/firenio
- Owner: FireNio
- License: apache-2.0
- Created: 2016-02-24T02:14:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-04-19T08:04:33.000Z (7 months ago)
- Last Synced: 2024-06-21T22:42:16.889Z (5 months ago)
- Topics: http, java, java-nio, nio, protocol, websocket
- Language: Java
- Homepage: https://firenio.com(No Served)
- Size: 880 KB
- Stars: 347
- Watchers: 37
- Forks: 93
- Open Issues: 15
-
Metadata Files:
- Readme: README-en.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# FireNio Project
[![Website](https://img.shields.io/badge/website-firenio-green.svg)](https://www.firenio.com)
[![Maven central](https://img.shields.io/badge/maven-1.3.6-green.svg)](https://search.maven.org/search?q=a:firenio-all)
[![License](https://img.shields.io/badge/License-Apache%202.0-585ac2.svg)](https://github.com/firenio/firenio/blob/master/LICENSE.txt)FireNio is an io framework which can build network project fast, it based on java nio, it is popular with Developers because of simple and easy of use APIs and high-performance.
## Features
* support protocol extend, known:
* LengthValue protocol, for detail {firenio-test}
* HTTP1.1 protocol(lite), for detail: https://www.firenio.com/
* WebSocket protocol, for detail: https://www.firenio.com/web-socket/chat/index.html
* Protobase(custom) support text or binay, for detail {firenio-test}
* easy to support reconnect (easy to support heart beat)
* supported ssl (JdkSSL & OpenSSL)
* TFB load test
* [TFB Benchmark(Physical)](https://www.techempower.com/benchmarks/#section=data-r18&hw=ph&test=plaintext)
* [TFB Benchmark(Cloud)](https://www.techempower.com/benchmarks/#section=data-r18&hw=cl&test=plaintext)
## Quick Start* Maven Dependency
```xml
com.firenio
firenio-all
1.3.6
```
* Simple Server:```Java
public static void main(String[] args) throws Exception {
IoEventHandle eventHandleAdaptor = new IoEventHandle() {
@Override
public void accept(Channel ch, Frame f) throws Exception {
String text = f.getStringContent();
f.setContent(ch.allocateWithSkipHeader(1));
f.write("yes server already accept your message:", ch);
f.write(text, ch);
ch.writeAndFlush(f);
}
};
ChannelAcceptor context = new ChannelAcceptor(8300);
context.addChannelEventListener(new LoggerChannelOpenListener());
context.setIoEventHandle(eventHandleAdaptor);
context.addProtocolCodec(new LengthValueCodec());
context.bind();
}```
* Simple Client:
```Java
public static void main(String[] args) throws Exception {
ChannelConnector context = new ChannelConnector("127.0.0.1", 8300);
IoEventHandle eventHandle = new IoEventHandle() {
@Override
public void accept(Channel ch, Frame f) throws Exception {
System.out.println();
System.out.println("____________________" + f.getStringContent());
System.out.println();
context.close();
}
};context.setIoEventHandle(eventHandle);
context.addChannelEventListener(new LoggerChannelOpenListener());
context.addProtocolCodec(new LengthValueCodec());
Channel ch = context.connect(3000);
LengthValueFrame frame = new LengthValueFrame();
frame.setString("hello server!", ch);
ch.writeAndFlush(frame);
}```
### more samples see project {firenio-test}
## Sample at website:
* HTTP Demo:https://www.firenio.com/index.html
* WebSocket Chat Demo:https://www.firenio.com/web-socket/chat/index.html
(server based on firenio,client based on: https://github.com/socketio/socket.io/ )
* WebSocket Rumpetroll Demo:https://www.firenio.com/web-socket/rumpetroll/index.html
(server based on firenio,client based on:https://github.com/danielmahal/Rumpetroll )## License
FireNio is released under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).