Commit 8d4bafe0 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Tweak documentation of protocol.js.

parent c0413a43
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
/** /**
* toHex formats an array as a hexadecimal string. * toHex formats an array as a hexadecimal string.
*
* @param {number[]|Uint8Array} array - the array to format * @param {number[]|Uint8Array} array - the array to format
* @returns {string} - the hexadecimal representation of array * @returns {string} - the hexadecimal representation of array
*/ */
...@@ -503,6 +504,9 @@ ServerConnection.prototype.request = function(what) { ...@@ -503,6 +504,9 @@ ServerConnection.prototype.request = function(what) {
}; };
/** /**
* findByLocalId finds an active connection with the given localId.
* It returns null if none was find.
*
* @param {string} localId * @param {string} localId
* @returns {Stream} * @returns {Stream}
*/ */
...@@ -521,6 +525,10 @@ ServerConnection.prototype.findByLocalId = function(localId) { ...@@ -521,6 +525,10 @@ ServerConnection.prototype.findByLocalId = function(localId) {
} }
/** /**
* getRTCConfiguration returns the RTCConfiguration that should be used
* with this peer connection. This usually comes from the server, but may
* be overridden by the onpeerconnection callback.
*
* @param {boolean} up * @param {boolean} up
* @returns {RTCConfiguration} * @returns {RTCConfiguration}
*/ */
...@@ -667,7 +675,7 @@ ServerConnection.prototype.groupAction = function(kind, message) { ...@@ -667,7 +675,7 @@ ServerConnection.prototype.groupAction = function(kind, message) {
}; };
/** /**
* Called when we receive an offer from the server. Don't call this. * gotOffer is called when we receive an offer from the server. Don't call this.
* *
* @param {string} id * @param {string} id
* @param {string} label * @param {string} label
...@@ -794,7 +802,8 @@ ServerConnection.prototype.gotOffer = async function(id, label, source, username ...@@ -794,7 +802,8 @@ ServerConnection.prototype.gotOffer = async function(id, label, source, username
}; };
/** /**
* Called when we receive an answer from the server. Don't call this. * gotAnswer is called when we receive an answer from the server. Don't
* call this.
* *
* @param {string} id * @param {string} id
* @param {string} sdp * @param {string} sdp
...@@ -824,8 +833,8 @@ ServerConnection.prototype.gotAnswer = async function(id, sdp) { ...@@ -824,8 +833,8 @@ ServerConnection.prototype.gotAnswer = async function(id, sdp) {
}; };
/** /**
* Called when we receive a renegotiation request from the server. Don't * gotRenegotiate is called when we receive a renegotiation request from
* call this. * the server. Don't call this.
* *
* @param {string} id * @param {string} id
* @function * @function
...@@ -838,7 +847,8 @@ ServerConnection.prototype.gotRenegotiate = function(id) { ...@@ -838,7 +847,8 @@ ServerConnection.prototype.gotRenegotiate = function(id) {
}; };
/** /**
* Called when we receive a close request from the server. Don't call this. * gotClose is called when we receive a close request from the server.
* Don't call this.
* *
* @param {string} id * @param {string} id
*/ */
...@@ -852,7 +862,8 @@ ServerConnection.prototype.gotClose = function(id) { ...@@ -852,7 +862,8 @@ ServerConnection.prototype.gotClose = function(id) {
}; };
/** /**
* Called when we receive an abort message from the server. Don't call this. * gotAbort is called when we receive an abort message from the server.
* Don't call this.
* *
* @param {string} id * @param {string} id
*/ */
...@@ -864,7 +875,8 @@ ServerConnection.prototype.gotAbort = function(id) { ...@@ -864,7 +875,8 @@ ServerConnection.prototype.gotAbort = function(id) {
}; };
/** /**
* Called when we receive an ICE candidate from the server. Don't call this. * gotRemoteIce is called when we receive an ICE candidate from the server.
* Don't call this.
* *
* @param {string} id * @param {string} id
* @param {RTCIceCandidate} candidate * @param {RTCIceCandidate} candidate
...@@ -1104,6 +1116,9 @@ Stream.prototype.close = function(replace) { ...@@ -1104,6 +1116,9 @@ Stream.prototype.close = function(replace) {
}; };
/** /**
* recomputeUserStreams recomputes the user.down array for a given user.
* It returns true if anything changed.
*
* @param {ServerConnection} sc * @param {ServerConnection} sc
* @param {string} id * @param {string} id
* @param {Stream} [c] * @param {Stream} [c]
...@@ -1164,7 +1179,7 @@ Stream.prototype.abort = function() { ...@@ -1164,7 +1179,7 @@ Stream.prototype.abort = function() {
}; };
/** /**
* Called when we get a local ICE candidate. Don't call this. * gotLocalIce is Called when we get a local ICE candidate. Don't call this.
* *
* @param {RTCIceCandidate} candidate * @param {RTCIceCandidate} candidate
* @function * @function
...@@ -1183,6 +1198,7 @@ Stream.prototype.gotLocalIce = function(candidate) { ...@@ -1183,6 +1198,7 @@ Stream.prototype.gotLocalIce = function(candidate) {
/** /**
* flushLocalIceCandidates flushes any buffered local ICE candidates. * flushLocalIceCandidates flushes any buffered local ICE candidates.
* It is called when we send an offer. * It is called when we send an offer.
*
* @function * @function
*/ */
Stream.prototype.flushLocalIceCandidates = function () { Stream.prototype.flushLocalIceCandidates = function () {
...@@ -1205,6 +1221,7 @@ Stream.prototype.flushLocalIceCandidates = function () { ...@@ -1205,6 +1221,7 @@ Stream.prototype.flushLocalIceCandidates = function () {
/** /**
* flushRemoteIceCandidates flushes any buffered remote ICE candidates. It is * flushRemoteIceCandidates flushes any buffered remote ICE candidates. It is
* called automatically when we get a remote description. * called automatically when we get a remote description.
*
* @function * @function
*/ */
Stream.prototype.flushRemoteIceCandidates = async function () { Stream.prototype.flushRemoteIceCandidates = async function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment