June 2024
Beginner to intermediate
268 pages
6h 26m
English
With the user interface in pretty awesome, responsive shape, let’s shift focus to JavaScript and handle a few important tasks to prepare the chat’s behavior for use with a data channel. We’ll need to listen for submit events on the form element and append chat messages to the chat log. And of course we will need to decide how and when to attach a data channel to the call, and provide logic for both peers to send and receive messages over it.
Messages need to be appended to the chat log when users either send or receive messages. Let’s define a function that handles both cases. The function will take a few arguments: the message sender (self or peer), the element for the chat ...
Read now
Unlock full access