klaytn/caver-js

Add message emission when subscription connected

Closed this issue · 2 comments

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

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

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