Skip to content

Commit

Permalink
Allow ws and wss protocols for nodejsconsole (#709)
Browse files Browse the repository at this point in the history
Now the nodejsconsole accepts a URL as opposed to a network address,
this allows us to connect via websocket and secure websocket protocols.

As part of this PR we also updated the events that trigger the go github
actions workflow so that it runs on PR's submitted from forked repositories.
 
Removes `ws:` protocol prefix from URL, so that users can specify either `ws://<IP>:<port>` or `wss://<IP>:<port>` on the command line, which allows TLS encrypted connections, e.g. `./console wss://rpc4.bakerloo.autonity.network:8546`.
  • Loading branch information
flofrie committed Nov 2, 2020
1 parent 4b9a0a0 commit 7656dcc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Go
on: [push]
on: [push, pull_request]
jobs:
bootstrap-checkout:
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions nodejsconsole/console
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh

if [ -z $1 ]; then
echo "Usage: ./console <websocket enabled autonity rpc host and port>"
echo "E.G: ./console localhost:8546"
echo "Usage: ./console <ws://... or wss://... url>"
echo "E.G: ./console ws://localhost:8546"
exit 1
fi

Expand Down Expand Up @@ -36,7 +36,7 @@ echo
# Note the --experimental-repl-await doesn't take effect for the code executed with eval.
node --experimental-repl-await --eval "
let Web3=require('web3');
let web3 = new Web3('ws://$1');
let web3 = new Web3('$1');
let contract;
let autonity;
Expand Down Expand Up @@ -863,7 +863,7 @@ moduleInit.set('lespay', lesPay);
let WebSocket = require('ws');
let ws = new WebSocket('ws://$1');
let ws = new WebSocket('$1');
let data = JSON.stringify({
jsonrpc:'2.0',
Expand Down
2 changes: 1 addition & 1 deletion tests/testdata
Submodule testdata updated 2006 files

0 comments on commit 7656dcc

Please sign in to comment.