-
Notifications
You must be signed in to change notification settings - Fork 154
Description
Describe the bug
I use a ws connection from my Nodejs app, that uses web3 libraries. The connection via wss works properly with the public API of the IOTA evm testnet and I can interact with smart contracts and even listen to events. The problem is with a local wasp node and a private chain that I deployed. The connection is made with ws (and not wss) as the wasp node runs with HTTP (not HTTPS). With wscat I am able to get a response. The nodejs app initially connects with the web socket, and I can call view functions from a smart contract, but when I try to call a normal function (i.e. where I have to spend gas) or subscribe to events, the connection stops. Moreover, once I do that, with wscat I am not able anymore to connect to the web socket, and I get "error: Unexpected server response: 429". To get it working again I need to run "docker compose down" and then "docker compose up".
To Reproduce
- Run a local HTTP(s) hornet node and wasp node.
- Deploy a private chain
- Deploy a simple smart contract to the chain
- Connect to the ws via the Web3 functions
- Interact with the contract, via Web3 functions
- See error
Expected behavior
The connection should not stop, as it is working without errors in public testnets.
Screenshots
Screenshot of the error in my nodejs app (running on localhost:3000)

Network and versioning
- Type of L1 network: IOTA testnet
- Type of Wasp chain: Private chain
- Interaction method: JSON/RPC Websocket
- Interaction software: Web3 libraries, nodejs app
- Version of Wasp 1.2.0-alpha.1 and 1.4.0-alpha.3
Additional context
The connection to the web socket from the nodejs app, is made with: web3 = new Web3(new Web3.providers.WebsocketProvider(ws://localhost/wasp/api/v1/chains/tst1pqsvlxmlvj9fkq6uuz0y48m6wucgdsqpt70ftmgzn95ase5wrjtqy7msdq4/evm/ws));