Wardrik. HTTP
(wardrik v0.1.0-rc.1)
Copy Markdown
Serves Wardrik over HTTP. See WardrikHTTP for the routes.
It serves:
- every operation at its route
- streaming operations as server-sent events
- the tool workers' WebSocket at
/v1/workers - chat apps' requests to channels
- sign-in callback pages
Run it as a child, with Bandit:
children = [MyApp.AgentRuntime, {Wardrik.HTTP, wardrik: MyApp.AgentRuntime, port: 4000}]Or forward to it from your router, as a Plug:
forward "/agents", Wardrik.HTTP, wardrik: MyApp.AgentRuntimeOptions
:wardrik- required. The module to serve, asMyApp.AgentRuntime.:authenticator- seeWardrikHTTP.:keepalive- seeWardrikHTTP.
As a child it also takes Bandit's options, such as :port. That needs :bandit in your deps.
Summary
Functions
Returns a :body_reader for Plug.Parsers.
Returns a child spec that serves Wardrik with Bandit.
Functions
Returns a :body_reader for Plug.Parsers.
Use it if your app parses bodies before Wardrik. It keeps the raw body so webhook signatures can still be checked.
plug Plug.Parsers, parsers: [:json], json_decoder: JSON, body_reader: Wardrik.HTTP.body_reader()
@spec child_spec(keyword()) :: Supervisor.child_spec()
Returns a child spec that serves Wardrik with Bandit.