Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add websocket entrypoint for app #26

Merged
merged 32 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9e658d1
Add websocket entrypoint for app
Sotatek-PhucTa Apr 23, 2024
55c1f23
Add subscribe for event execute
Sotatek-JohnnyNguyen Apr 24, 2024
8ecfd0f
Integrate with communicate service for furthur handling
Sotatek-JohnnyNguyen Apr 24, 2024
48b4744
Add test for method not allowed
Sotatek-JohnnyNguyen Apr 24, 2024
f7a0ed8
feat: implement swith method when emit ws
Sotatek-JohnnyNguyen Apr 25, 2024
cf364c0
chore: define response for event ws
Sotatek-JohnnyNguyen Apr 26, 2024
4e55ad3
chore: update unit test for metho net_version
Sotatek-JohnnyNguyen May 2, 2024
18c2782
feat: change socket.io to websocket
Sotatek-JohnnyNguyen May 3, 2024
c643b49
feat: change unit test from socketio to pure socket
Sotatek-JohnnyNguyen May 4, 2024
895947c
feat: refactor code
Sotatek-William May 9, 2024
0b70808
feat: refactor code
Sotatek-William May 9, 2024
2a401ca
remove wsPort, add .env.example file and comment unit test
Sotatek-William May 10, 2024
de5a966
add eth_subscribe and eth_unsubscribe to allowedMethods array
Sotatek-William May 10, 2024
8b341d5
optimize code logic
Sotatek-William May 10, 2024
9e89e83
add step Set configuration variables to README file
Sotatek-William May 10, 2024
a4dbb2d
fix: check socket connection
Sotatek-William May 10, 2024
f5390b5
check rate limit if request is sendrawtransaction
Sotatek-William May 13, 2024
9687449
check rate limit if request is sendrawtransaction
Sotatek-William May 13, 2024
cff24e1
add-unit-test
Sotatek-William May 14, 2024
55f6bff
add-unit-test
Sotatek-William May 14, 2024
402e71e
improve unit test
Sotatek-William May 15, 2024
d21fe70
add reconnect method
Sotatek-William May 15, 2024
db29b85
add reconnect method
Sotatek-William May 15, 2024
85178a8
update README
Sotatek-William May 16, 2024
f829080
fix README and keep the connection even if error from node's websocke…
Sotatek-William May 16, 2024
15482a5
fix: issues reported by BOT
Sotatek-William May 17, 2024
62ff16c
update: communicate test file and README
Sotatek-JohnnyNguyen May 21, 2024
ca56fda
update: communicate test file and README
Sotatek-JohnnyNguyen May 21, 2024
d00874b
update: .env.example file
Sotatek-JohnnyNguyen May 21, 2024
b72b24f
update: communicate test file
Sotatek-JohnnyNguyen May 21, 2024
b789678
Apply formatter
ironbeer May 21, 2024
bf0e2f4
Merge pull request #27 from oasysgames/features/add-support-web-socke…
ironbeer May 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
VERSE_MASTER_NODE_URL=
VERSE_URL=
VERSE_READ_NODE_URL=http://localhost:8545
BLOCK_NUMBER_CACHE_EXPIRE_SEC=
DATASTORE=redis
REDIS_URI=redis://localhost:6379
NODE_SOCKET=ws://[::]:8546
PORT=3000
MAXRECONNECTATTEMPTS=10
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,33 @@ Details are described later.
- `src/config/configuration.ts`
- `src/config/transactionAllowList.ts`

### 3. Set up npm
### 3. Set configuration variables
- Create file `.env` refer to `.env.example`
- Update those variables with corrected values from your side

### 4. Set up redis server
- Verse-Proxy use redis as a database to read and write data, so in order to run this proxy you will need start a redis server and pass url to `REDIS_URI`
- also Verse-Proxy need to know which database you would use which can be config using `DATASTORE`
For example:
```
DATASTORE=redis
REDIS_URI=redis://localhost:6379
```

### 5. Handle disconnect from node's websocket
- `MAXRECONNECTATTEMPTS` specifies the maximum number of attempts the Verse-proxy will make to reconnect to a node's websocket.
**example**:
```
MAXRECONNECTATTEMPTS: 10
```

### 6. Set up npm
```bash
$ npm install
$ npm build
```

### 4. Run app
### 7. Run app

```bash
# development
Expand Down
Loading
Loading