# `Hunter.Streaming.Event`
[🔗](https://github.com/milmazz/hunter/blob/v0.8.0/lib/hunter/streaming/event.ex#L1)

A parsed event from Mastodon's streaming WebSocket

## Fields

  * `streams` - the stream names this event was delivered on
  * `type` - the event type, e.g. `"update"`, `"notification"`, `"delete"`
  * `payload` - the decoded payload: an entity struct for known types, the
    bare id string for `delete`/`announcement.delete`, `nil` for
    payload-less events, or the raw payload for unknown types

# `t`

```elixir
@type t() :: %Hunter.Streaming.Event{
  payload: term(),
  streams: [String.t()],
  type: String.t()
}
```

# `parse`

```elixir
@spec parse(binary()) :: {:ok, t()} | {:error, term()}
```

Parses a raw WebSocket text frame into an event.

Mastodon frames look like
`{"stream": ["user"], "event": "update", "payload": "<JSON string>"}` —
the payload is itself JSON-encoded, except for `delete` (a bare id) and
payload-less events. Unknown event types are passed through with the raw
payload so new server-side types keep flowing.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
