Welcome to the Javascript MESH client repo. This repository houses a Javascript MESH client which can be used by any nodejs application to communicate with MESH
This library does not require any external dependencies beyond those used in the src directory files. However, ensure you have a modern version of Node.js installed that supports ES Modules.
you can install the module with npm i nhs-mesh-client
jsdocs can be accessed here
This client is compatible with the sandbox, integration and production MESH systems.
The repository is structured into several directories, each containing specific types of operations:
get/
: Contains functions for retrieving information from the message exchange system.put/
: Contains functions for updating the status of messages.post/
: Contains functions for creating or sending messages.examples/
: Contains examples on how to use the functions in practical scenarios.
handShake
: Establishes a connection with the message exchange system, ensuring that communication is possible.
getMessageCount
: Retrieves the count of messages currently stored in the mailbox.readMessage
: Reads the content of a specific message.
markAsRead
: Marks a message as read or acknowledged, updating its status within the system.
sendMessage
: Sends a new message to the specified recipient.sendChunkedMessage
: Sends a large message in chunks, suitable for handling large datasets or files.
loadConfig
: Loads and returns configuration settings for the message exchange system, preparing it for operation.createMessages
: Demonstrates how to create and send a message using the system.createMessageChunks
: Demonstrates how to send a large message in chunks.receiveMessage
: Demonstrates how to retrieve and process messages from the mailbox.
To use any of the provided functions, first ensure you have the necessary configuration. This typically involves setting up authentication details, specifying the target mailbox IDs, and other relevant settings. Here's a basic example
import { loadConfig, createMessages } from "./src/index.js";
async function main() {
const config = await loadConfig({
logLevel: "DEBUG",
url: "https://example.com/messaging",
// additional configuration options...
});
await createMessages(config);
}
main();
Contributions to improve or extend the functionality of this message exchange system are welcome. Please follow the existing code structure and document any new functions or changes thoroughly.
npm test
will execute meshService.test.js.
Maintainers: andrew cleveland
Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation.
Any HTML or Markdown documentation is © Crown Copyright and available under the terms of the Open Government Licence v3.0.