# Function envelope::parse_command

> Parses a whole or reassembled command envelope `text`.

`zaun_community_protocol::envelope::parse_command` · Function

```rust
pub fn parse_command(text: &str, negotiated: Option<u16>) -> Result<CommandEnvelope, Rejection>
```

Parses a whole or reassembled command envelope `text`.

`negotiated` is the connection's negotiated version, `None` before a successful
`session.hello`.

# Errors
A `Rejection` with `BAD_REQUEST` (malformed JSON, missing or ill-typed field, bad id
encoding, `request_id: null` outside `signal.*`), `UNSUPPORTED_VERSION` or
`PAYLOAD_TOO_LARGE`.

[Full rustdoc page](/docs/api/rust/zaun-community-protocol/zaun_community_protocol/envelope/inbound/fn.parse_command.html)
