-
Notifications
You must be signed in to change notification settings - Fork 5
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
Changes from 24 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
9e658d1
Add websocket entrypoint for app
Sotatek-PhucTa 55c1f23
Add subscribe for event execute
Sotatek-JohnnyNguyen 8ecfd0f
Integrate with communicate service for furthur handling
Sotatek-JohnnyNguyen 48b4744
Add test for method not allowed
Sotatek-JohnnyNguyen f7a0ed8
feat: implement swith method when emit ws
Sotatek-JohnnyNguyen cf364c0
chore: define response for event ws
Sotatek-JohnnyNguyen 4e55ad3
chore: update unit test for metho net_version
Sotatek-JohnnyNguyen 18c2782
feat: change socket.io to websocket
Sotatek-JohnnyNguyen c643b49
feat: change unit test from socketio to pure socket
Sotatek-JohnnyNguyen 895947c
feat: refactor code
Sotatek-William 0b70808
feat: refactor code
Sotatek-William 2a401ca
remove wsPort, add .env.example file and comment unit test
Sotatek-William de5a966
add eth_subscribe and eth_unsubscribe to allowedMethods array
Sotatek-William 8b341d5
optimize code logic
Sotatek-William 9e89e83
add step Set configuration variables to README file
Sotatek-William a4dbb2d
fix: check socket connection
Sotatek-William f5390b5
check rate limit if request is sendrawtransaction
Sotatek-William 9687449
check rate limit if request is sendrawtransaction
Sotatek-William cff24e1
add-unit-test
Sotatek-William 55f6bff
add-unit-test
Sotatek-William 402e71e
improve unit test
Sotatek-William d21fe70
add reconnect method
Sotatek-William db29b85
add reconnect method
Sotatek-William 85178a8
update README
Sotatek-William f829080
fix README and keep the connection even if error from node's websocke…
Sotatek-William 15482a5
fix: issues reported by BOT
Sotatek-William 62ff16c
update: communicate test file and README
Sotatek-JohnnyNguyen ca56fda
update: communicate test file and README
Sotatek-JohnnyNguyen d00874b
update: .env.example file
Sotatek-JohnnyNguyen b72b24f
update: communicate test file
Sotatek-JohnnyNguyen b789678
Apply formatter
ironbeer bf0e2f4
Merge pull request #27 from oasysgames/features/add-support-web-socke…
ironbeer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
NODE_SOCKET=ws://[::]:8546 | ||
PORT=3000 | ||
REDIS_URI=redis://localhost:6373 | ||
MAXRECONNECTATTEMPTS=10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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:6373 | ||
``` | ||
|
||
### 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 | ||
``` | ||
|
||
### 5. Set up npm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Sotatek-JohnnyNguyen
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, my bad. let me fix this |
||
```bash | ||
$ npm install | ||
$ npm build | ||
``` | ||
|
||
### 4. Run app | ||
### 6. Run app | ||
|
||
```bash | ||
# development | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sotatek-JohnnyNguyen
I believe the default port for Redis is 6379. Is there a specific reason it was changed to 6373?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used 6373 for my redis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sotatek-JohnnyNguyen
https://github.com/oasysgames/verse-proxy/blob/fc1b97ce63bcb370bffbda97419523cdb95c89c8/docs/RateLimit.md?plain=1
Since the above mentions REDIS, please adjust the README as needed.
https://github.com/oasysgames/verse-proxy/blob/master/docs/RateLimit.md
I think it would be preferable to list DATASTORE and REDIS_URI side by side.
And Redis' default port is 6379, so I think
REDIS_URI=redis://localhost:6379
is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Sotatek-JohnnyNguyen
Have you checked the above comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have, but from my perspective, I don't think we need to change anything here since the README tells what it needs to tell about the datastore config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review my commit