Skip to content

CrowdHailer/pollux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pollux

Work with JSON RPC (jsonrpc 2.0)

Package Version Hex Docs

gleam add pollux@1

Usage

Pollux requires you to define your own application types for Request/Notification and response

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

gleam run   # Run the project
gleam test  # Run the tests

Credit

Created for EYG, a new integration focused programming language.

About

Work with JSON RPC (jsonrpc 2.0)

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages