You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey , thanks for this awesome promised based SFTP client. As this library provides a wrapper over the native ssh2 library, I feel that some parts are very restricted.
In the current usecase, I want to listen to handshake event as mentioned in the client-events generated by ssh2. I will use the negotiated kex algorithm to decide the cpu limits for next operations.
Currently I am using node-ssh@^6.0.0 which have following type declaration for the SSH class.
I checked the lib code for this version and found that the connection is set to null in constructor and then a new ssh2 instance is created whenever connect method is called.
The connect method connects to SFTP server and return the same instance of the class (for chaining most probably).
If I want to add event listener for handshake event then I will need access to this.connection which is created in the connect method but I can only add this once connect method is completed so event listener won't even invoked.
I checked the code for latest version in this repo. The type definitions are improved but still I can't access the underlying connection instance before connect or pass event handlers for handshake event.
Am I missing something here if it is possible with the library? If it is not, which is the best way of getting the data returned in handshake event (without using ssh2 directly which means I have to depend on two libraries)? Thanks
The text was updated successfully, but these errors were encountered:
aditya81070
changed the title
can not add handshake event handler to detect negotiated key exchange algorithm
can not add event listener for handshake event to identify negotiated kex
May 12, 2023
Hey @steelbrain , thanks for the answer. 😂 Nicely used the async nature of javascript. If I am understanding it correctly, you have called the connect promise and put it into event loop and as you are not awaiting the next line will be executed and new event listener will be attached to same connection instance and after that you wait for fulfilment of the already fired promise. As connection creation will take time anyway so this listener will be attached.
Hey , thanks for this awesome promised based SFTP client. As this library provides a wrapper over the native ssh2 library, I feel that some parts are very restricted.
In the current usecase, I want to listen to handshake event as mentioned in the client-events generated by ssh2. I will use the negotiated kex algorithm to decide the cpu limits for next operations.
Currently I am using
node-ssh@^6.0.0
which have following type declaration for the SSH class.I checked the lib code for this version and found that the connection is set to null in constructor and then a new ssh2 instance is created whenever
connect
method is called.The connect method connects to SFTP server and return the same instance of the class (for chaining most probably).
If I want to add event listener for
handshake
event then I will need access tothis.connection
which is created in theconnect
method but I can only add this once connect method is completed so event listener won't even invoked.I checked the code for latest version in this repo. The type definitions are improved but still I can't access the underlying connection instance before connect or pass event handlers for handshake event.
Am I missing something here if it is possible with the library? If it is not, which is the best way of getting the data returned in handshake event (without using ssh2 directly which means I have to depend on two libraries)? Thanks
Edit: Just found out that [email protected]. is using [email protected] which didn't have handshake event as it was added in [email protected] as part of rewrite (mscdex/ssh2#935)
The text was updated successfully, but these errors were encountered: