Skip to content

Commit

Permalink
Merge pull request #16 from uihilab/dev-branch
Browse files Browse the repository at this point in the history
improve on documentation
  • Loading branch information
erazocar authored Sep 5, 2024
2 parents 3ed68cc + 9ed1454 commit e015533
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Configuration {

/**
* @method setUsecases
* @memberof configuration
* @param {Array} usecases - Usecases for the library instance
*/
setUsecases(usecases) {
Expand All @@ -15,6 +16,7 @@ class Configuration {

/**
* @method setReceiveDataTypes
* @memberof configuration
* @param {Array} receiveDataTypes - Setter for receiving data types
*/
setReceiveDataTypes(receiveDataTypes) {
Expand All @@ -23,6 +25,7 @@ class Configuration {

/**
* @method setSendDataTypes
* @memberof configuration
* @param {Array} sendDataTypes - Different data types that will be used throughout the library instance
*/

Expand Down
30 changes: 20 additions & 10 deletions src/hydrortcclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ class HydroRTCClient {
}

/**
* @method getPeers - Retrieves the list of peers for the current client
* @method getPeers
* @description Retrieves the list of peers for the current client
* @memberof HydroRTCClient
* @returns {Function} - Event emitter for the peer listener
*/
Expand All @@ -585,7 +586,8 @@ class HydroRTCClient {
}

/**
* @method getPeersID - Retrieves the peer ID for the specified remote peer
* @method getPeersID
* @description Retrieves the peer ID for the specified remote peer
* @memberof HydroRTCClient
* @param {String} remotePeerId - The ID of the remote peer
* @returns {Function} - Event emitter for the peer listener
Expand All @@ -599,7 +601,8 @@ class HydroRTCClient {
}

/**
* @method listenRequests - Enables the client to receive connection requests from other peers
* @method listenRequests
* @description Enables the client to receive connection requests from other peers
* @memberof HydroRTCClient
* @returns {Function} - Event handler for the connection request
*/
Expand All @@ -610,7 +613,8 @@ class HydroRTCClient {
}

/**
* @method setConfiguration - Configures the client's use cases and data types for sending and receiving
* @method setConfiguration
* @description Configures the client's use cases and data types for sending and receiving
* @memberof HydroRTCClient
* @param {string[]} usecases - The use cases to be enabled for the client
* @param {string[]} receiveDataTypes - The data types the client can receive
Expand All @@ -624,7 +628,8 @@ class HydroRTCClient {
}

/**
* @method getConfiguration - Retrieves the current configuration of the client
* @method getConfiguration
* @description Retrieves the current configuration of the client
* @memberof HydroRTCClient
* @returns {Object} - The current configuration of the client
*/
Expand All @@ -633,7 +638,8 @@ class HydroRTCClient {
};

/**
* @method getAvailableUsecases - Retrieves the available use cases for the client
* @method getAvailableUsecases
* @description Retrieves the available use cases for the client
* @memberof HydroRTCClient
* @returns {string[]} - The available use cases
*/
Expand All @@ -642,7 +648,8 @@ class HydroRTCClient {
};

/**
* @method getAvailableDataTypes - Retrieves the available data types for the client
* @method getAvailableDataTypes
* @description Retrieves the available data types for the client
* @memberof HydroRTCClient
* @returns {string[]} - The available data types
*/
Expand All @@ -653,7 +660,8 @@ class HydroRTCClient {
// --- Collaborative Data Exchange Start ---

/**
* @method requestDataFromPeer - Requests data from a specified peer
* @method requestDataFromPeer
* @description Requests data from a specified peer
* @memberof HydroRTCClient
* @param {string} peerName - The name of the peer to request data from
* @param {Promise} request - The data request to be sent to the peer
Expand All @@ -677,7 +685,8 @@ class HydroRTCClient {

// connects client with given peer
/**
* @method connectPeer - Connect a client with a specific peer
* @method connectPeer
* @description Connect a client with a specific peer
* @memberof HydroRTCClient
* @param {string} peerName - The name of the peer to connect to
* @returns {Promise<void>} - A promise that resolves when the connection is established
Expand All @@ -687,7 +696,8 @@ class HydroRTCClient {
}

/**
* @method sendDataToPeer - Send data to a connected peer
* @method sendDataToPeer
* @description Send data to a connected peer
* @memberof HydroRTCClient
* @param {Object} data - The data to be sent to the peer
* @param {string} [usecase='message'] - The use case for the data being sent (default is 'message')
Expand Down
2 changes: 1 addition & 1 deletion src/hydrortcserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class HydroRTC {

/**
* Allows for tasks to be set into a specific users. See documentation for the types of tasks and/or distribtuon that can be done
* @param {Array} tasks - Array of tasks to be set into the
* @param {Array} tasks - Array of tasks to be set into the . This is an auxiliary method that will be further improved.
*/
setTasks(tasks) {
this.server.setTasks(tasks);
Expand Down
11 changes: 8 additions & 3 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ class HydroRTCServer {
}

/**
* @method serveFile - Reads and serves a specified file to the client's response
* @method serveFile
* @description Reads and serves a specified file to the client's response
* @memberof HydroRTCServer
* @param {Object} response - Response object to send data back to the client
* @param {String} filename - Path of the file to be served
Expand Down Expand Up @@ -242,7 +243,8 @@ class HydroRTCServer {
}

/**
* @method joinServer - Joins a peer to the existing server and gets broadcasted to the exisiting peer list.
* @method joinServer
* @description Joins a peer to the existing server and gets broadcasted to the exisiting peer list.
* @memberof HydroRTCServer
* @param {Object} socket - Socket representing the peer's connection
* @param {Object} peer - Information about the joining peer.
Expand All @@ -268,7 +270,8 @@ class HydroRTCServer {
}

/**
* @method validateUser - validates that a user is already registered on the live server.
* @method validateUser
* @description validates that a user is already registered on the live server.
* @memberof HydroRTCServer
* @param {Object} socket - current socket used by the user
* @param {Object} data - peer data available
Expand Down Expand Up @@ -684,6 +687,7 @@ class HydroRTCServer {

/**
* @method setTasks
* @memberof HydroRTCServer
* @param {Object} tasks
*/

Expand All @@ -693,6 +697,7 @@ class HydroRTCServer {

/**
* @method getAddress
* @memberof HydroRTCServer
* @returns {String} - The address of a given host and port
*/

Expand Down

0 comments on commit e015533

Please sign in to comment.