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
What I've found is that there is an undocumented event that gets fired called session. It is fired when this packet is received:
2.2.10.1 Server Save Session Info PDU
The Save Session Info PDU is used by the server to transmit session and user logon information back to the client after the user has logged on.
What I've done is to set a timeout on how long I want to wait for the login (after the connect happens) and listen for the session event as the I successfully logged in event. It ends up looking something like this, though I'd turn this into a module that returns a promise and uses resolve/reject:
constrdp=require('node-rdpjs');functionlogin(userName,domain,password,server,loginTimeoutMs){constclientConfig={
userName,
domain,
password,autoLogin: true};console.log(`connecting to ${server} using username=${clientConfig.userName} domain=${clientConfig.domain}`);letloginTimer=null;rdp.createClient(clientConfig).on('connect',function(){console.log(`Connection created. This is different than the session being created (being logged in). Waiting ${loginTimeoutMs}ms for session to be created.`);//wait loginTimeoutMs before saying session event didn't happenloginTimer=setTimeout(()=>{thrownewError(`Timeout occured after ${loginTimeoutMs}ms waiting on session to be created. There was most likely a problem logging in.`);},loginTimeoutMs);}).on('session',function(){console.log('Session created. Now we are logged in.');if(loginTimer){loginTimer.clearTimeout();}// I have a logged in session!}).on('error',function(err){throwerr;}).connect(server,3389);}
@citronneur does this seem like the correct use of that event or am I misunderstanding what it means?
How i can understand, if i connected with login and password was successful?
The text was updated successfully, but these errors were encountered: