> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simli.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Peer_to_peer

> Peer to Peer WebRTC 

[Compose Session Token](/api-reference/compose-session-token) is sent as query parameter string

enableSFU is a query parameter boolean (default true) to opt into sending the traffic through cloudflare network for improved reliability

First message must be offer. Offer must be provided within 20 seconds of opening the websocket, or the session ends with `STOP REASON: failed to receive RTC Offer`. Once offer is sent, a corresponding answer will be sent from the server which can be used as described [here](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setRemoteDescription)




## AsyncAPI

````yaml api-reference/asyncapi.yaml peer_to_peer
id: peer_to_peer
title: Peer_to_peer
description: >
  Peer to Peer WebRTC 


  [Compose Session Token](/api-reference/compose-session-token) is sent as query
  parameter string


  enableSFU is a query parameter boolean (default true) to opt into sending the
  traffic through cloudflare network for improved reliability


  First message must be offer. Offer must be provided within 20 seconds of
  opening the websocket, or the session ends with `STOP REASON: failed to
  receive RTC Offer`. Once offer is sent, a corresponding answer will be sent
  from the server which can be used as described
  [here](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setRemoteDescription)
servers:
  - id: Simli WSS
    protocol: wss
    host: api.simli.ai
    bindings: []
    variables:
      - id: session_token
        description: Session token generated by https://api.simli.ai/compose/token
        allowedValues: []
        examples: []
address: /compose/webrtc/p2p
parameters: []
bindings: []
operations:
  - &ref_12
    id: sendOffer
    title: Send offer
    type: send
    messages:
      - &ref_27
        id: offer
        contentType: text/plain
        payload:
          - name: offer
            description: >-
              RTC Offer as generated by
              https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer
              or compatible
            type: object
            properties:
              - name: type
                type: string
                description: offer
                required: false
              - name: sdp
                type: string
                required: false
        headers: []
        jsonPayloadSchema:
          schema:
            type: object
            properties:
              type:
                type: string
                const: offer
                x-parser-schema-id: <anonymous-schema-2>
              sdp:
                type: string
                x-parser-schema-id: <anonymous-schema-3>
            x-parser-schema-id: <anonymous-schema-1>
        title: Offer
        description: >-
          RTC Offer as generated by
          https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer
          or compatible
        example: |-
          {
            "type": "<string>",
            "sdp": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: offer
          - id: x-parser-message-name
            value: rtc_offer
    bindings: []
    extensions: &ref_0
      - id: x-parser-unique-object-id
        value: peer_to_peer
  - &ref_5
    id: recvAnswer
    title: Recv answer
    type: receive
    messages:
      - &ref_20
        id: answer
        contentType: text/plain
        payload:
          - name: answer
            description: >-
              RTC Answer as generated by
              https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createAnswer
              or compatible. Will be received AFTER an offer has been sent
            type: object
            properties:
              - name: type
                type: string
                description: answer
                required: false
              - name: sdp
                type: string
                required: false
        headers: []
        jsonPayloadSchema:
          schema:
            type: object
            properties:
              type:
                type: string
                const: answer
                x-parser-schema-id: <anonymous-schema-5>
              sdp:
                type: string
                x-parser-schema-id: <anonymous-schema-6>
            x-parser-schema-id: <anonymous-schema-4>
        title: Answer
        description: >-
          RTC Answer as generated by
          https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createAnswer
          or compatible. Will be received AFTER an offer has been sent
        example: |-
          {
            "type": "<string>",
            "sdp": "<string>"
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: answer
          - id: x-parser-message-name
            value: rtc_answer
    bindings: []
    extensions: *ref_0
  - &ref_13
    id: sendAudioChunk_peer_to_peer
    title: Send audio chunk_peer_to_peer
    type: send
    messages:
      - &ref_28
        id: audio_chunk
        contentType: application/octet-stream
        payload:
          - type: string
            format: bytestring
            x-parser-schema-id: <anonymous-schema-7>
            name: audio_chunk
            description: >-
              Binary stream of the audio that the Avatar will lipsync to. Sent
              as a binary stream (in JS/TS UInt8Arr)
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            format: bytestring
            x-parser-schema-id: <anonymous-schema-7>
        title: Audio_chunk
        description: >-
          Binary stream of the audio that the Avatar will lipsync to. Sent as a
          binary stream (in JS/TS UInt8Arr)
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: audio_chunk
          - id: x-parser-message-name
            value: audio_chunk
    bindings: []
    extensions: *ref_0
  - &ref_14
    id: playImmediate_peer_to_peer
    title: Play immediate_peer_to_peer
    type: send
    messages:
      - &ref_29
        id: play_immediate
        contentType: application/octet-stream
        payload:
          - type: string
            format: bytestring
            x-parser-schema-id: <anonymous-schema-8>
            name: play_immediate
            description: >
              Interrupts the avatar and plays new audio at once. Sent as binary:
              the ASCII prefix `PLAY_IMMEDIATE` (14 bytes), then audio in the
              same format as audio_chunk (PCM16, 16 kHz, mono), in one message.


              Everything you sent before it that the avatar hasn't spoken yet is
              dropped, as with SKIP, and this audio starts playing from where
              the avatar is now. Audio chunks you send after it play after it.


              Use it when the user interrupts and the reply is already in hand:
              one message drops the old audio and starts the new one, instead of
              a SKIP and then audio chunks. It can carry the whole reply, or
              just its start (Simli's reference client sends the first 4 seconds
              this way) with the rest following as ordinary audio chunks. An odd
              trailing byte is dropped. After DONE, it only interrupts: the
              audio in it isn't played.
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            format: bytestring
            x-parser-schema-id: <anonymous-schema-8>
        title: Play_immediate
        description: >
          Interrupts the avatar and plays new audio at once. Sent as binary: the
          ASCII prefix `PLAY_IMMEDIATE` (14 bytes), then audio in the same
          format as audio_chunk (PCM16, 16 kHz, mono), in one message.


          Everything you sent before it that the avatar hasn't spoken yet is
          dropped, as with SKIP, and this audio starts playing from where the
          avatar is now. Audio chunks you send after it play after it.


          Use it when the user interrupts and the reply is already in hand: one
          message drops the old audio and starts the new one, instead of a SKIP
          and then audio chunks. It can carry the whole reply, or just its start
          (Simli's reference client sends the first 4 seconds this way) with the
          rest following as ordinary audio chunks. An odd trailing byte is
          dropped. After DONE, it only interrupts: the audio in it isn't played.
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: play_immediate
          - id: x-parser-message-name
            value: play_immediate
    bindings: []
    extensions: *ref_0
  - &ref_15
    id: clearBuffer_peer_to_peer
    title: Clear buffer_peer_to_peer
    type: send
    messages:
      - &ref_30
        id: clear_buffer
        contentType: text/plain
        payload:
          - type: string
            const: SKIP
            x-parser-schema-id: <anonymous-schema-9>
            name: clear_buffer
            description: >-
              Client Signal to make the avatar stop speaking immediately and
              ignore all previously sent audio
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            const: SKIP
            x-parser-schema-id: <anonymous-schema-9>
        title: Clear_buffer
        description: >-
          Client Signal to make the avatar stop speaking immediately and ignore
          all previously sent audio
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: clear_buffer
          - id: x-parser-message-name
            value: clear_buffer
    bindings: []
    extensions: *ref_0
  - &ref_16
    id: finalMessage_peer_to_peer
    title: Final message_peer_to_peer
    type: send
    messages:
      - &ref_31
        id: final_message
        contentType: text/plain
        payload:
          - type: string
            const: DONE
            x-parser-schema-id: <anonymous-schema-10>
            name: final_message
            description: >-
              Client Signal to tell the server that the final segment of audio
              has been already sent and that it should close after playing it
              back
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            const: DONE
            x-parser-schema-id: <anonymous-schema-10>
        title: Final_message
        description: >-
          Client Signal to tell the server that the final segment of audio has
          been already sent and that it should close after playing it back
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: final_message
          - id: x-parser-message-name
            value: final_message
    bindings: []
    extensions: *ref_0
  - &ref_17
    id: sendCamera_peer_to_peer
    title: Send camera_peer_to_peer
    type: send
    messages:
      - &ref_32
        id: camera
        contentType: application/octet-stream
        payload:
          - type: string
            format: bytestring
            x-parser-schema-id: <anonymous-schema-11>
            name: camera
            description: >
              Moves the camera, Trinity-2 faces only. Sent as binary: the ASCII
              prefix `CAM_`, then little-endian float32 camera offsets on top of
              the avatar's own framing, in this order (y comes before x):


              | # | Field | Meaning | Supported range |

              |---|-------|---------|-----------------|

              | 1 | pos_y_off | Moves the avatar down, in half canvas heights |
              -10 to 10 |

              | 2 | pos_x_off | Moves the avatar right, in half canvas widths |
              -10 to 10 |

              | 3 | pos_z_off | Metres the camera backs away from the avatar
              (negative moves in) | -5 to 5 |

              | 4 | zoom | Multiplies the avatar's zoom; 1 is no change | above
              0, up to 4 |

              | 5 | rot_x_off | Degrees the camera tilts up (pitch) | -180 to
              180 |

              | 6 | rot_y_off | Degrees the camera pans right (yaw) | -180 to
              180 |

              | 7 | rot_z_off | Degrees the camera rolls clockwise | -180 to 180
              |

              | 8 | orbit_x_off | Degrees the camera orbits up over the avatar's
              head (elevation) | -80 to 80 |

              | 9 | orbit_y_off | Degrees the camera orbits round to its right
              (azimuth) | -180 to 180 |


              Send the first 4, the first 7 or all 9 values; the ones left off
              stay neutral (0).


              Each message replaces the whole camera, including the one the
              session started with (the session token's `camera`): the values
              are offsets from the avatar's own framing, not from the previous
              message. 0, 0, 0, 1, 0, 0, 0, 0, 0 returns to the avatar's own
              framing.


              The camera cuts to the new setting. To glide instead, append the
              ASCII tag `LERP` and one more float32: the seconds the move takes,
              from wherever the camera is now (part-way through an earlier
              glide, if one is running). 0 or less is a cut.


              A message is 20, 32 or 40 bytes, or 28, 40 or 48 with `LERP`. A
              value outside its supported range is still applied, with a
              `WARNING:` reply. Any other length, NaN or infinity is rejected
              and the camera stays where it is. See camera_notice.
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            format: bytestring
            x-parser-schema-id: <anonymous-schema-11>
        title: Camera
        description: >
          Moves the camera, Trinity-2 faces only. Sent as binary: the ASCII
          prefix `CAM_`, then little-endian float32 camera offsets on top of the
          avatar's own framing, in this order (y comes before x):


          | # | Field | Meaning | Supported range |

          |---|-------|---------|-----------------|

          | 1 | pos_y_off | Moves the avatar down, in half canvas heights | -10
          to 10 |

          | 2 | pos_x_off | Moves the avatar right, in half canvas widths | -10
          to 10 |

          | 3 | pos_z_off | Metres the camera backs away from the avatar
          (negative moves in) | -5 to 5 |

          | 4 | zoom | Multiplies the avatar's zoom; 1 is no change | above 0,
          up to 4 |

          | 5 | rot_x_off | Degrees the camera tilts up (pitch) | -180 to 180 |

          | 6 | rot_y_off | Degrees the camera pans right (yaw) | -180 to 180 |

          | 7 | rot_z_off | Degrees the camera rolls clockwise | -180 to 180 |

          | 8 | orbit_x_off | Degrees the camera orbits up over the avatar's
          head (elevation) | -80 to 80 |

          | 9 | orbit_y_off | Degrees the camera orbits round to its right
          (azimuth) | -180 to 180 |


          Send the first 4, the first 7 or all 9 values; the ones left off stay
          neutral (0).


          Each message replaces the whole camera, including the one the session
          started with (the session token's `camera`): the values are offsets
          from the avatar's own framing, not from the previous message. 0, 0, 0,
          1, 0, 0, 0, 0, 0 returns to the avatar's own framing.


          The camera cuts to the new setting. To glide instead, append the ASCII
          tag `LERP` and one more float32: the seconds the move takes, from
          wherever the camera is now (part-way through an earlier glide, if one
          is running). 0 or less is a cut.


          A message is 20, 32 or 40 bytes, or 28, 40 or 48 with `LERP`. A value
          outside its supported range is still applied, with a `WARNING:` reply.
          Any other length, NaN or infinity is rejected and the camera stays
          where it is. See camera_notice.
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: camera
          - id: x-parser-message-name
            value: camera
    bindings: []
    extensions: *ref_0
  - &ref_6
    id: cameraNotice_peer_to_peer
    title: Camera notice_peer_to_peer
    type: receive
    messages:
      - &ref_21
        id: camera_notice
        contentType: text/plain
        payload:
          - type: string
            oneOf: &ref_1
              - pattern: '^WARNING: .+$'
                description: >-
                  Values outside their supported range, applied as sent. Each
                  reads `camera <field> <value> is outside its supported range
                  [<low>, <high>]; applied as is` (zoom's range opens with `(`),
                  separated by `; `.
                x-parser-schema-id: <anonymous-schema-13>
              - const: Invalid camera override received
                description: >-
                  The payload was the wrong length, or held NaN or infinity. The
                  camera is unchanged.
                x-parser-schema-id: <anonymous-schema-14>
              - const: Selected model does not support camera overrides
                description: The face is not Trinity-2. The camera is unchanged.
                x-parser-schema-id: <anonymous-schema-15>
            x-parser-schema-id: <anonymous-schema-12>
            name: camera_notice
            description: >-
              Server replies to a camera message, sent as text. None of them end
              the session.
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            oneOf: *ref_1
            x-parser-schema-id: <anonymous-schema-12>
          example: >-
            WARNING: camera zoom 6.0 is outside its supported range (0.0, 4.0];
            applied as is
        title: Camera_notice
        description: >-
          Server replies to a camera message, sent as text. None of them end the
          session.
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: camera_notice
          - id: x-parser-message-name
            value: camera_notice
    bindings: []
    extensions: *ref_0
  - &ref_18
    id: sendBackground_peer_to_peer
    title: Send background_peer_to_peer
    type: send
    messages:
      - &ref_33
        id: background
        contentType: text/plain
        payload:
          - type: string
            pattern: >-
              ^BG_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
            x-parser-schema-id: <anonymous-schema-16>
            name: background
            description: >
              Puts one of your uploaded backgrounds behind the avatar, Trinity-2
              faces only: the ASCII prefix `BG_` and the background's id, as
              `POST /assets/backgrounds` returned it, 36 characters (hyphens
              included, either case). Text or binary; 39 characters in all,
              nothing else is accepted. An image can't be sent: upload it first.
              The background is cropped to fill the session's canvas.


              Only your own backgrounds: an id that isn't one of your account's
              is ignored. It replaces the one the session started with (the
              session token's `background_id`) a moment later, once loaded;
              audio keeps playing meanwhile, and the last one sent wins. See
              asset_notice.


              `BG_00000000-0000-0000-0000-000000000000` (the nil UUID) goes back
              to the avatar's own background, at once.
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            pattern: >-
              ^BG_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
            x-parser-schema-id: <anonymous-schema-16>
          example: BG_6f1c2a9e-1b2c-4d3e-8f90-0123456789ab
        title: Background
        description: >
          Puts one of your uploaded backgrounds behind the avatar, Trinity-2
          faces only: the ASCII prefix `BG_` and the background's id, as `POST
          /assets/backgrounds` returned it, 36 characters (hyphens included,
          either case). Text or binary; 39 characters in all, nothing else is
          accepted. An image can't be sent: upload it first. The background is
          cropped to fill the session's canvas.


          Only your own backgrounds: an id that isn't one of your account's is
          ignored. It replaces the one the session started with (the session
          token's `background_id`) a moment later, once loaded; audio keeps
          playing meanwhile, and the last one sent wins. See asset_notice.


          `BG_00000000-0000-0000-0000-000000000000` (the nil UUID) goes back to
          the avatar's own background, at once.
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: background
          - id: x-parser-message-name
            value: background
    bindings: []
    extensions: *ref_0
  - &ref_19
    id: sendForeground_peer_to_peer
    title: Send foreground_peer_to_peer
    type: send
    messages:
      - &ref_34
        id: foreground
        contentType: text/plain
        payload:
          - type: string
            pattern: >-
              ^FG_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
            x-parser-schema-id: <anonymous-schema-17>
            name: foreground
            description: >
              Lays one of your uploaded foregrounds over the avatar through its
              transparency, Trinity-2 faces only: the ASCII prefix `FG_` and the
              foreground's id, as `POST /assets/foregrounds` returned it, 36
              characters. Text or binary; 39 characters in all, nothing else is
              accepted, an image least of all. Otherwise as background, in place
              of the session token's `foreground_id`.
              `FG_00000000-0000-0000-0000-000000000000` (the nil UUID) takes the
              foreground away.
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            pattern: >-
              ^FG_[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
            x-parser-schema-id: <anonymous-schema-17>
          example: FG_6f1c2a9e-1b2c-4d3e-8f90-0123456789ab
        title: Foreground
        description: >
          Lays one of your uploaded foregrounds over the avatar through its
          transparency, Trinity-2 faces only: the ASCII prefix `FG_` and the
          foreground's id, as `POST /assets/foregrounds` returned it, 36
          characters. Text or binary; 39 characters in all, nothing else is
          accepted, an image least of all. Otherwise as background, in place of
          the session token's `foreground_id`.
          `FG_00000000-0000-0000-0000-000000000000` (the nil UUID) takes the
          foreground away.
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: foreground
          - id: x-parser-message-name
            value: foreground
    bindings: []
    extensions: *ref_0
  - &ref_7
    id: assetNotice_peer_to_peer
    title: Asset notice_peer_to_peer
    type: receive
    messages:
      - &ref_22
        id: asset_notice
        contentType: text/plain
        payload:
          - type: string
            oneOf: &ref_2
              - pattern: '^Invalid (background|foreground) message: .+$'
                description: Not `BG_`/`FG_` and an id of 36 characters (an image, say).
                x-parser-schema-id: <anonymous-schema-19>
              - pattern: >-
                  ^(background|foreground) \S+ is not one of your uploaded
                  (backgrounds|foregrounds), ignoring$
                description: >-
                  No such id among your account's uploads of that kind: never
                  uploaded, deleted, or another account's.
                x-parser-schema-id: <anonymous-schema-20>
              - pattern: ^Couldn't load (background|foreground) \S+, ignoring$
                description: It couldn't be fetched or read just now; send it again.
                x-parser-schema-id: <anonymous-schema-21>
              - pattern: >-
                  ^Selected model does not support a custom
                  (background|foreground)$
                description: The face is not Trinity-2.
                x-parser-schema-id: <anonymous-schema-22>
            x-parser-schema-id: <anonymous-schema-18>
            name: asset_notice
            description: >-
              Server replies to a background or foreground message, sent as
              text; a message that is applied gets none. None of them end the
              session, and the avatar keeps what it had.
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            oneOf: *ref_2
            x-parser-schema-id: <anonymous-schema-18>
          example: >-
            background 6f1c2a9e-1b2c-4d3e-8f90-0123456789ab is not one of your
            uploaded backgrounds, ignoring
        title: Asset_notice
        description: >-
          Server replies to a background or foreground message, sent as text; a
          message that is applied gets none. None of them end the session, and
          the avatar keeps what it had.
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: asset_notice
          - id: x-parser-message-name
            value: asset_notice
    bindings: []
    extensions: *ref_0
  - &ref_8
    id: videoMetadata_peer_to_peer
    title: Video metadata_peer_to_peer
    type: receive
    messages:
      - &ref_23
        id: video_metadata
        contentType: text/plain
        payload:
          - name: video_metadata
            description: >-
              Sent as JSON text once the session is set up, just before START.
              `fps`, `width` and `height` are integers: the frame rate and size
              of the video Simli streams. For a Trinity-2 face, `width` x
              `height` is the session token's `streaming_width` x
              `streaming_height`, an odd side rounded up by a pixel, at 25 fps.
              A Trinity-1 face streams 512 x 512 at 25 fps.
            type: object
            properties:
              - name: video_metadata
                type: object
                required: true
                properties:
                  - name: fps
                    type: integer
                    description: Frames per second
                    required: true
                  - name: width
                    type: integer
                    description: Video width in pixels
                    required: true
                  - name: height
                    type: integer
                    description: Video height in pixels
                    required: true
        headers: []
        jsonPayloadSchema:
          schema:
            type: object
            required:
              - video_metadata
            properties:
              video_metadata:
                type: object
                required:
                  - fps
                  - width
                  - height
                properties:
                  fps:
                    type: integer
                    description: Frames per second
                    x-parser-schema-id: <anonymous-schema-25>
                  width:
                    type: integer
                    description: Video width in pixels
                    x-parser-schema-id: <anonymous-schema-26>
                  height:
                    type: integer
                    description: Video height in pixels
                    x-parser-schema-id: <anonymous-schema-27>
                x-parser-schema-id: <anonymous-schema-24>
            x-parser-schema-id: <anonymous-schema-23>
          example:
            video_metadata:
              fps: 25
              width: 768
              height: 768
        title: Video_metadata
        description: >-
          Sent as JSON text once the session is set up, just before START.
          `fps`, `width` and `height` are integers: the frame rate and size of
          the video Simli streams. For a Trinity-2 face, `width` x `height` is
          the session token's `streaming_width` x `streaming_height`, an odd
          side rounded up by a pixel, at 25 fps. A Trinity-1 face streams 512 x
          512 at 25 fps.
        example: |-
          {
            "video_metadata": {
              "fps": 123,
              "width": 123,
              "height": 123
            }
          }
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: video_metadata
          - id: x-parser-message-name
            value: video_metadata
    bindings: []
    extensions: *ref_0
  - &ref_9
    id: event_peer_to_peer
    title: Event_peer_to_peer
    type: receive
    messages:
      - &ref_24
        id: event
        contentType: text/plain
        payload:
          - type: string
            enum: &ref_3
              - START
              - ACK
              - STOP
              - SPEAK
              - SILENT
            x-parser-schema-id: <anonymous-schema-28>
            name: event
            description: Server sent signals
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            enum: *ref_3
            x-parser-schema-id: <anonymous-schema-28>
        title: Event
        description: Server sent signals
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: event
          - id: x-parser-message-name
            value: event
    bindings: []
    extensions: *ref_0
  - &ref_10
    id: endframe_peer_to_peer
    title: Endframe_peer_to_peer
    type: receive
    messages:
      - &ref_25
        id: endframe
        contentType: text/plain
        payload:
          - type: string
            pattern: ^ENDFRAME:[0-9]+$
            x-parser-schema-id: <anonymous-schema-29>
            name: endframe
            description: >-
              Sent as text when the session ends, just before `CLOSING REASON:
              <reason>` and STOP: `ENDFRAME:` and the number of video frames the
              session streamed, an integer (the video's running time times its
              fps).
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            pattern: ^ENDFRAME:[0-9]+$
            x-parser-schema-id: <anonymous-schema-29>
          example: ENDFRAME:1500
        title: Endframe
        description: >-
          Sent as text when the session ends, just before `CLOSING REASON:
          <reason>` and STOP: `ENDFRAME:` and the number of video frames the
          session streamed, an integer (the video's running time times its fps).
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: endframe
          - id: x-parser-message-name
            value: endframe
    bindings: []
    extensions: *ref_0
  - &ref_11
    id: error_peer_to_peer
    title: Error_peer_to_peer
    type: receive
    messages:
      - &ref_26
        id: error
        contentType: text/plain
        payload:
          - type: string
            oneOf: &ref_4
              - pattern: ^(?i)ERROR\s+.+$
                description: Matches 'ERROR' regardless of casing.
                x-parser-schema-id: <anonymous-schema-31>
              - pattern: ^(?i)RATE\s+.+$
                description: Matches 'RATE' followed by a space.
                x-parser-schema-id: <anonymous-schema-32>
              - pattern: ^(?i)CLOSING\s+.+$
                description: Matches 'CLOSING' followed by a space.
                x-parser-schema-id: <anonymous-schema-33>
            x-parser-schema-id: <anonymous-schema-30>
            name: error
            description: >-
              Termination messages that specify the reason for immediate
              termination, including a routing error (Routing error, no EU
              Sessions available. EU ONLY PROCESSING enabled) when a
              region-pinned session lands on a machine outside its region
        headers: []
        jsonPayloadSchema:
          schema:
            type: string
            oneOf: *ref_4
            x-parser-schema-id: <anonymous-schema-30>
          example: 'ERROR: INVALID_API_KEY'
        title: Error
        description: >-
          Termination messages that specify the reason for immediate
          termination, including a routing error (Routing error, no EU Sessions
          available. EU ONLY PROCESSING enabled) when a region-pinned session
          lands on a machine outside its region
        example: '{}'
        bindings: []
        extensions:
          - id: x-parser-unique-object-id
            value: error
          - id: x-parser-message-name
            value: error
    bindings: []
    extensions: *ref_0
sendOperations:
  - *ref_5
  - *ref_6
  - *ref_7
  - *ref_8
  - *ref_9
  - *ref_10
  - *ref_11
receiveOperations:
  - *ref_12
  - *ref_13
  - *ref_14
  - *ref_15
  - *ref_16
  - *ref_17
  - *ref_18
  - *ref_19
sendMessages:
  - *ref_20
  - *ref_21
  - *ref_22
  - *ref_23
  - *ref_24
  - *ref_25
  - *ref_26
receiveMessages:
  - *ref_27
  - *ref_28
  - *ref_29
  - *ref_30
  - *ref_31
  - *ref_32
  - *ref_33
  - *ref_34
extensions:
  - id: x-parser-unique-object-id
    value: peer_to_peer
securitySchemes: []

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.