View Source Nostr.Event.Dispatcher (Nostr v0.1.3)
Receive raw nostr protocol events and send them to the right module so it can be parsed in the appropriate way and sent back in a usable way
Link to this section Summary
Functions
Dispatch to the right event type depending on content received
Link to this section Functions
Dispatch to the right event type depending on content received
examples
Examples
iex> %{
...> "content" => "aren't you entertained?",
...> "created_at" => 1_672_082_699,
...> "id" => "e02903e546a84d54772121f4bbbe213f171103a3c3a121b5531098dafdaba725",
...> "kind" => 1,
...> "pubkey" => "5ab9f2efb1fda6bc32696f6f3fd715e156346175b93b6382099d23627693c3f2",
...> "sig" =>
...> "8d3b6dc22f3a94e1491ebb6997ff220156c89826e925e383430d0e488e80f4b5aaa03d04f75a3dafd80a97d42a7546c048720b9861cf0df776da824de716f5a6",
...> "tags" => []
...> }
...> |> Nostr.Event.Dispatcher.dispatch
{
:ok,
%Nostr.Event.Types.TextEvent{
event: %Nostr.Event{
id: "e02903e546a84d54772121f4bbbe213f171103a3c3a121b5531098dafdaba725",
pubkey: <<0x5AB9F2EFB1FDA6BC32696F6F3FD715E156346175B93B6382099D23627693C3F2::256>>,
created_at: ~U[2022-12-26 19:24:59Z],
kind: 1,
tags: [],
content: "aren't you entertained?",
sig:
<<0x8D3B6DC22F3A94E1491EBB6997FF220156C89826E925E383430D0E488E80F4B5AAA03D04F75A3DAFD80A97D42A7546C048720B9861CF0DF776DA824DE716F5A6::512>>
}
}
}