diff --git a/DEVELOP.md b/DEVELOP.md new file mode 100644 index 0000000..16a20d3 --- /dev/null +++ b/DEVELOP.md @@ -0,0 +1,15 @@ +# Development Guide + +1. install http-server to enable debug at local. + +```bash +npm install -g http-server +``` +2. run `npm install` to build the project. +3. in `./` folder, use `http-server` to start server +4. open the following link to debug. + please note, the server address should be checked in the source code of `xxx.html`! +``` +http://127.0.0.1:8080/test/ws.html +http://127.0.0.1:8080/test/http.html +``` \ No newline at end of file diff --git a/package.json b/package.json index 327a0b6..7490d08 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bdware/bdcontract-sdk", - "version": "0.3.0-alpha.14", + "version": "0.3.0-alpha.15", "description": "BDContract SDK for Node.js and browsers", "license": "MIT", "keywords": [ @@ -47,5 +47,14 @@ "shx": "^0.3.4", "sucrase": "^3.25.0", "typescript": "^4.8.2" - } + }, + "directories": { + "lib": "lib", + "test": "test" + }, + "repository": { + "type": "git", + "url": "git@gitea.internetapi.cn:bdware/bdcontract-sdk-javascript.git" + }, + "author": "caihq@pku.edu.cn" } diff --git a/test/ws.html b/test/ws.html index 80f04aa..086b271 100644 --- a/test/ws.html +++ b/test/ws.html @@ -10,18 +10,20 @@ document.write(`${string}\n\n`) } - const url = 'ws://39.104.201.40:18010/SCIDE/SCExecutor' + const url = 'ws://127.0.0.1:18000/SCIDE/SCExecutor' const client = new bdcontract.WsClient( url, (ev) => { - console.log(JSON.stringify(ev)) + console.log("onOpen:"+JSON.stringify(ev)) + invokeContract() }, (ev, ws) => { console.log(ev.data) }, ) - setTimeout(async () => { + function invokeContract(){ + setTimeout(async () => { const status = client.status() console.log(status) try { @@ -42,6 +44,8 @@ print(JSON.stringify(data)) } }, 1000) + } +