Vibe 3.0.0-Alpha1 released
flowersinthesand wrote this on
After one year of work, it is my pleasure to announce that the first alpha of Vibe is released as the next version of Atmosphere.
Vibe has started since I shared experience on creating Yet Another Atmosphere as an effort to make Atmosphere a better project. After long discussion with Atmosphere's community and lead, we decided to start from scratch having better API and extension points in mind and to extract the protocol as a separate project to make it easy to use Vibe with any language.
Vibe is simple! For working example, please refer to the quick start guide of Java Server and JavaScript Client.
Java Server
Server server = new DefaultServer();
server.socketAction(new Action<ServerSocket>() {
@Override
public void on(final ServerSocket socket) {
socket.on("echo", new Action<String>() {
@Override
public void on(String data) {
socket.send("echo", data);
}
});
socket.on("chat", new Action<String>() {
@Override
public void on(String data) {
server.all().send("chat", data);
}
});
}
});
JavaScript Client
vibe.open("http://localhost:8080/vibe")
.on("open", function() {
this.send("echo", "An echo message");
this.send("chat", "A chat message");
})
.on("echo", function(data) {
console.log("on echo event:", data);
})
.on("chat", function(data) {
console.log("on chat event:", data);
});
Here is a summary of key features in Vibe overall:
- Based on protocol - Real-time web will be everywhere soon. You will need more features to write a just simple real-time webapp. The separated protocol is the baseline to build such features.
- Polyglot - It’s not just for Java and JavaScript but for any language. Thanks to the reference implementation and test suite, it’s easy to not only implement the protocol in any language but also verify implementation.
- Web standards - As component of the protocol, RFC and W3C standards are adopted. You don't need to do much to implement the protocol. Just use existing implementation as desired.
- Reliable full duplex connection - 8 transports implementing WebSocket as well as Streaming and Long Polling are designed for all on the web by carefully considering their known issues.
- Concise high-level API - You don’t need to be aware of low-level details like which transport underlies a socket and its quirks. Focus on how you will handle a given socket either by client or server only.
- Event based - The unit of data to be sent and be received from the semantic point of view is the event object associated with a customizable type rather than plain text message, which is easy to compose a controller from MVC.
- Protocol extension - Protocol extension is a pattern or feature to make the best use of full duplex connection for modern web application development. Features will be provided as protocol extension.
- Reply - Reply is a protocol extension, which allows for the sender to attach callbacks in sending event and for the receiver to call them with the result of the event processing in receiving event. It’s useful where simple event-notification is not sufficient like Acknowledgement and Remote Procedure Call.
- Lightweight client - In case of JavaScript Client, it takes 5.92KB minified and gzipped. Compare it to others: Socket.IO 1.1.0 - 17.77KB, Sockjs 0.3.4 - 10.09KB and Autobahn latest - 36.27KB.
- Broad browser support - According to the browser support policy following the one of jQuery 1.x embracing Internet Explorer 6, transports are designed.
- Connection sharing on browser - Socket can be shared and used across multiple tabs and windows as long as browser session is alive and they work as a single client to server.
- Simplified server - All interface you need to know to handle Java server is Server producing and managing socket and ServerSocket representing the remote client. Select some sockets from server and do something with them like handling DOM using jQuery.
- Tag - Unlike a socket that is just a connection from a specific client, the tag gives you a way to handle a specific entity in the real world as an identifier of a group of sockets. You can use it to model a user logged in using multiple devices and subscribers to a specific topic.
- Dependency injection friendly - A use case with Dependency Injection framework is definite. Define a server as a singleton component and inject it wherever you want to handle socket just like using EntityManager from Java Persistence API.
- Scalable - Shared nothing architecture is adopted to scale application horizontally with ease. What you need to cluster application is just a Message Oriented Middleware supporting publish and subscribe model.
- Run any platform on Java - Because Java server is built on Vibe Java Platform, which is a simple abstraction layer for full-stack web application frameworks and raw web servers running on Java Virtual Machine, you can run your application on any supported platform seamlessly. Now Play framework 2.x, Vert.x 2.x, Atmosphere 2.x, Servlet 3.x and Java WebSocket API 1.x are supported.
And here is the future roadmap of Vibe:
- Migration guide - A guide for Atmosphere 2.x users.
- Full Atmosphere 2.x concepts support - Broadcaster, BroadcasterCache and AtmosphereInterceptor concepts support.
- Help migrating other framework - Special help, patches and pull requests for all framework integrating Atmosphere.
- Handshaking - An entry point for authentication and protocol negotiation.
- Transport calculation - A process to find the very working transport for a given situation.
- Authentication - A helper for authentication like cookie-based model and token-based model.
- Replaceable event format - A separated serializer/deserializer per a socket to allow to replace the event format with one supporting use of binary data.
- Enhanced connection sharing - A protocol-level support for multiplexing logical sockets over a single physical connection.
- HTTP2 - New transports based on fresh new HTTP2.
- Transport API - API to add/remove custom transports.
- Annotation-driven API - A declarative way to handle socket using annotated POJOs.
- Event buffering - A means for tagged sockets to make up for missing events over their life cycle.
- Standalone - A standalone server where you don’t need a separate platform.
- Handling binary data - An ability to handle WebSocket binary message and to read HTTP request with binary body.
- Reading data by chunk - An efficient way to read very big data.
- Netty platform - A platform to run application on Netty.
- Spring platform - A platform to run application on Spring framework.
- Error handling - Consistent exception hierarchy and an action to handle such errors.
For full documentation and information on Vibe, please visit the website.
Please feel free to ask any questions and give me your feedback about Vibe. It will make Vibe better and better. I look forward for you to join the Atmosphere Groups and let people know what you think as I did to make Atmosphere better and finally could get an opportunity to create Vibe as Atmosphere 3.
Last but not least, the creator of Vibe offers professional support for projects Vibe team maintained through Async-IO, the official sponsor of Vibe. You can bring out features in the roadmap or custom features you’ve wanted by priority and mitigate risk from introducing Vibe into your project and using the alpha stage work.