This repository was archived by the owner on Mar 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Merged
add websocket methods #6479
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
715cfe2
add getPendingRequestQueueSize
e28bba7
Merge branch '4.x' into 6451
Muhammad-Altabba 54e41cf
Merge branch '4.x' into 6451
239913d
add safe disconnect
2ba48ff
add getSentRequestsQueueSize and safeDisconnect
5e50f50
fix test
1d0068f
update test
db0ddc3
eslint disable
e75cc74
fix
997c92a
update import
f60f044
test
c80e256
add script
34f0bc2
add eslint disable
74dc98f
Revert "add script"
42e8a45
add try catch:
a32fbde
Merge branch '4.x' into 6451
e19c21a
remove afterall
dc97d3f
lint fix
800ddc0
remove failing testcase
23079e7
fix up
08e7634
add eslint disable
9f3aa15
add clearqueues as public method
55d931b
lint fix
107854d
address feedback
e89c17a
fix lint
0cd035d
update changelog
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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,43 @@ | ||
| /* | ||
| This file is part of web3.js. | ||
|
|
||
| web3.js is free software: you can redistribute it and/or modify | ||
| it under the terms of the GNU Lesser General Public License as published by | ||
| the Free Software Foundation, either version 3 of the License, or | ||
| (at your option) any later version. | ||
|
|
||
| web3.js is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU Lesser General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU Lesser General Public License | ||
| along with web3.js. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| import { WebSocketProvider } from 'web3-providers-ws'; | ||
| import { | ||
| describeIf, getSystemTestProvider, isWs, | ||
| } from '../shared_fixtures/system_tests_utils'; | ||
| import Web3 from '../../src/index'; | ||
|
|
||
|
|
||
|
|
||
| describe('Web3 instance', () => { | ||
| let web3: Web3; | ||
|
|
||
| beforeEach(() => { | ||
| const provider = getSystemTestProvider(); | ||
| web3 = new Web3(provider); | ||
| }); | ||
|
|
||
| describeIf(isWs)('web3 ws tests', () => { | ||
| it('should connect and disconnect using safe disconnect subscription successfully', async () => { | ||
| const subscription = await web3.eth.subscribe("newBlockHeaders"); | ||
| // eslint-disable-next-line | ||
| subscription.unsubscribe(); | ||
| // eslint-disable-next-line | ||
| await expect((web3.currentProvider as WebSocketProvider).safeDisconnect()).resolves.not.toThrow(); | ||
| }); | ||
| }); | ||
| }); |
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.
Uh oh!
There was an error while loading. Please reload this page.