⚡Socketioxide - SocketIO server powered by Rust! 🦀
Publish Date: Oct 10 '23
11 1
Rust is hard, so is writing networking code in it. But who doesn’t want its blazing fast speed? Socketioxide fills the gap. It’s socket.io, but with speed and safety, that helps you achieve unimaginable while keeping it dead simple.
Socket.io is a massively popular websocket/polling framework with about 60k stars on github. Socket.io server is officially written in Node.js, which was ported to Python, Go (upto v1.4), Java and Swift by the community. Now, there is a Rust port as well, Socketioxide:
A socket.io server implementation in Rust that integrates with the Tower ecosystem and the Tokio stack. It integrates with any server framework based on tower like Axum, Warp, Salvo, Viz or Hyper. Add any other tower based middleware on top of socketioxide such as CORS, authorization, compression, etc with tower-http.
protocol v5 : based on engine.io v4 under the feature flag v5 (default), (socket.io js from v3.0.0..latest)
protocol v4 : based on engine.io v3, feature flag v4, (socket.io js from v1.0.3..latest)
🪄 Power of Rust + Simplicity of Socket IO
The thing about socket.io is that it’s so simple, that someone who just learned JavaScript can get started with it. Write an html page, bring the client and hook some event listeners.
On the other hand, Rust is a language with powerful type system and runtime speed. Programs written in Rust are more memory safe than C, C++ etc. That makes Rust a great choice for both mission critical and general purpose software development.
Now that you can combine the simplicity and power together, Socketioxide emerges as a great choice for realtime apps.
🧑💻 How to get started with it?
This is an example of socket.io echo server with Socketioxide and Axum
Hmm... Nice