Page properties | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
|
Background
From the start of development of Iroha 2 we tried to limit the number of dependencies in order to ensure higher security. With the acceptance of Maintenance Endpoint RFC the work on implementation of HTTP and Web Socket API has been started. Taking into account the size of the team and the time constraints it seems reasonable to use already existing libraries for both of the selected protocols (HTTP, WebSocket), and therefore add these dependencies to Iroha 2. This RFC discusses the possibility of introducing these dependencies and the selection of these libraries if they are decided to be added.
...
It is suggested to use external libraries for both of these protocols. The pros and cons of this decision are shown below
Pros | Cons |
---|---|
|
|
Requirements for Libraries
...
The proposed libraries are the following:
Protocol | Library | Description |
---|---|---|
HTTP | http | A general purpose library of common HTTP types. This means that it will be needed to implement our own http server with the use of this library. |
Web Socket | async-tungstenite | Asynchronous WebSockets for async-std, tokio, gio and any std Future s runtime. Based on tungstenite crate. |
The usage of these libraries would in general mean that we will implement our own web server based on TCP streams, but the messages will be parsed with the help of http library. When the upgrade request for web socket will be received, then the connection management will be passed to async-tangstenite library.
Alternatives
Alternative | Description | Why not chosen |
---|---|---|
tiny_http as http server library | Low level HTTP server library | No async support |
hyper as http server library | A fast and correct HTTP implementation for Rust. Actually the fastest http server library according to techempower. |
|
actix / warp / rocket as web framework | Popular web frameworks with both warp and rocket being built on hyper library, |
|
Custom http and web socket libraries | It is possible to implement fully custom solution. | There are already existing solutions which correctly implement the standards and are widely used. The team will be able to focus on our unique functionality. |
Concerns
The chosen solution might take more time to implement but at the same time it gives us flexibility and minimal increase in dependencies.
...