# pollux
Work with JSON RPC (jsonrpc 2.0)
[](https://hex.pm/packages/pollux)
[](https://hexdocs.pm/pollux/)
```sh
gleam add pollux@1
```
## Usage
Pollux requires you to define your own application types for Request/Notification and response
```gleam
import pollux
/// App specific notifications
pub type MyNotification{
MyNotification
}
/// App specific request
pub type MyRequest {
MyRequest
}
pub type MyResponse {
MyResponse
}
fn request_decoder(){
pollux.request_decoder(my_request_decoder, my_notification_decoder, ZeroNotification)
}
pub fn server() {
case json.parse(input, my_decoder()) {
pollux.Request(id:, ..) -> {
pollux.response(id, Ok(MyResponse))
|> pollux.response_encode(my_response_encode)
}
pollux.Notification(..) -> todo
}
}
```
Further documentation can be found at <https://hexdocs.pm/pollux>.
## Development
```sh
gleam run # Run the project
gleam test # Run the tests
```
## Credit
Created for [EYG](https://eyg.run/), a new integration focused programming language.