Skip to content

Websockets doc issues #43

@rjp44

Description

@rjp44

Raising this issue as a convenient place to write down feedback on the new WebSocket docs as at c0cb486 and developer experience, as requested by @benlower.

connectionoptions.mdx:

Creating a WebSocket Call
Formatting issue with last code block on page, code block end not terminated properly.

Maybe I skim read this too quickly but bottom note says that WebSocket connections use same message format as WebRTC data channels, and ref common doc but don't say what the data format is. There is no message type documented for audio payload so I'm going to take a guess that the socket carries binary audio data, and textual JSON encoded messages. Looks like the receiver should test each message for isBinary and process binary data as audio data, text as JSON according to the message spec...

This should probably be documented, maybe even with a code sample like:

stream.on('message', (data, isBinary) => {
        if (isBinary) {
          // Process audio data
        }
        else {
          let message = JSON.parse(data.toString());
          console.log({ message  }, 'received Ultravox message');
        }
      });

Lastly, the Twilio block above gives some detail on setting the initiator for outgoing vs incoming calls. Assume this also applies to the websocket medium as, whilst the WebSocket connection is always initiated client service->Ultravox the client service could be connecting to an outgoing 'call'. Maybe a sentence to say that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions