klaytn / caver-js

Official caver-js repository
GNU Lesser General Public License v3.0
114 stars 75 forks source link

Add message emission when subscription connected #417

Closed sangsang242 closed 3 years ago

sangsang242 commented 3 years ago

Is your request related to a problem? Please describe. I want to get a notification when subscription connected.

Describe the solution you'd like Add message emission when subscription connected just like web3.js does.

At packages/caver-core-subscriptions/src/subscription.js subscribe()

this.options.requestManager.send(payload, function(err, result) {
    if (!err && result) {
        _this.id = result
        _this.emit('connected', result) // Added
jimni1222 commented 3 years ago

@sangsang242 Hi, thank you for reporting issue! Now caver-js v1.5.7-rc.2 is released, so you can use that :)

sangsang242 commented 3 years ago

Now I can close subscription connection at a specified time like 10 sec after 'connected'. Thanks a lot, @jimni1222!