huashengdun / webssh

:seedling: Web based ssh client
https://webssh.huashengdun.org/
MIT License
4.57k stars 1.31k forks source link

add delay to .send #391

Open CarlFK opened 2 months ago

CarlFK commented 2 months ago

https://github.com/huashengdun/webssh/blob/master/webssh/static/js/main.js#L447 wssh.send = function(data) {

I would like a delay between characters so it looks like someone typing.

So add an optional parameter of delay (in ms because setTimeout wants ms)

function(data,delay=0)
for each c in data 
  sock.send(c);
  something something setTimeout(resolve, delay))

I found this here: https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep

CarlFK commented 2 months ago

This seems like something that that should be coded by someone who knows what they are doing. Which is not me.

I will try to find someone to do this if I get some encouragement, like t seems like something that would be merged if done well.