<
 
 
 
 
×
>
hide You are viewing an archived web page, collected at the request of Ethereum Foundation using Archive-It. This page was captured on 14:10:48 Jun 25, 2021 , and is part of the Community collection. The information on this web page may be out of date. See All versions of this archived page. Loading media information

connection not open [email protected]

kashifazharkashifazhar Member Posts: 4
Hi Everyone ,

I have created a private network , and try to communicate between them using websocket but got the error . Searching solution for it for many days , some people are saying it is an open issue .

Can somebody has solution for this , Please help

my code is this

const Web3 = require('web3');
var net = require('net');
var web3 = new Web3('http://localhost:8545');
web3.setProvider(new Web3.providers.WebsocketProvider('ws://localhost:8546'));

var kId = web3.shh.newSymKey().then(function(receipt){ console.log(receipt) });
var identities = [];
var subscription = null;
var shh = web3.shh;

Promise.all([
shh.newSymKey().then((id) => {identities.push(id);}),
shh.newKeyPair().then((id) => {identities.push(id);})
]).then(() => { // will receive also its own message send, below
subscription = shh.subscribe("messages",
{ symKeyID: identities[0],
topics: ['0xffaadd11']
}).on('data', console.log);
}).then(() => {
web3.shh.post({ symKeyID: identities[0], // encrypts using the sym key ID
sig: identities[1], // signs the message using the keyPair ID
ttl: 10, topic: '0xffaadd11', payload: '0xffffffdddddd1122', powTime: 3, powTarget: 0.5
}).then(h => console.log(Message with hash ${h} was successfuly sent))
.catch(err => console.log("Error: ", err));
});


got the following error




connection not open on send()
connection not open on send()
connection not open on send()
(node:15264) UnhandledPromiseRejectionWarning: Error: connection not open
at WebsocketProvider.send (D:\RecommendationChain\node_modules\web3-providers-ws\src\index.js:247:18)
at Timeout._onTimeout (D:\RecommendationChain\node_modules\web3-providers-ws\src\index.js:232:19)
at ontimeout (timers.js:427:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10)
(node:15264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting
a promise which was not handled with .catch(). (rejection id: 1)
(node:15264) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a
non-zero exit code.
(node:15264) UnhandledPromiseRejectionWarning: Error: connection not open
at WebsocketProvider.send (D:\RecommendationChain\node_modules\web3-providers-ws\src\index.js:247:18)
at Timeout._onTimeout (D:\RecommendationChain\node_modules\web3-providers-ws\src\index.js:232:19)
at ontimeout (timers.js:427:11)
at tryOnTimeout (timers.js:289:5)
at listOnTimeout (timers.js:252:5)
at Timer.processTimers (timers.js:212:10)
(node:15264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting
a promise which was not handled with .catch(). (rejection id: 2)
Sign In or Register to comment.