mirror of
https://github.com/EvernodeXRPL/hp-devkit.git
synced 2026-04-29 15:37:58 +00:00
Client app sample.
This commit is contained in:
17
docker/code-templates/nodejs/blank-client/_projname_.js
Normal file
17
docker/code-templates/nodejs/blank-client/_projname_.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const HotPocket = require('hotpocket-js-client');
|
||||
|
||||
async function clientApp() {
|
||||
|
||||
const userKeyPair = await HotPocket.generateKeys();
|
||||
const client = await HotPocket.createClient(['wss://localhost:8081'], userKeyPair);
|
||||
|
||||
// Establish HotPocket connection.
|
||||
if (!await client.connect()) {
|
||||
console.log('Connection failed.');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('HotPocket Connected.');
|
||||
}
|
||||
|
||||
clientApp();
|
||||
6
docker/code-templates/nodejs/blank-client/package.json
Normal file
6
docker/code-templates/nodejs/blank-client/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "_projname_",
|
||||
"dependencies": {
|
||||
"hotpocket-js-client": "0.5.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user