xterm.js remote command execution
Hi,
I am running an online compiler. I run xterm.js inside a docker container.
My problem is, I want to take commands/ esp program from user from browser and send it to xterm.js container and show the output in xterm shell. How can I do that?
I am having a tough time getting this to work. Any help would be appreciated
You need to do the transport to/from the client/server. The xterm.js demo shows a basic example of this
That's fine but which xtrem.js api to use for remote command execution once
I send data from browser to xterm.js server ??
Xterm.writeln doesn't work. I need a rough idea about how to implement this.
On Sat, May 12, 2018, 1:47 AM Daniel Imms notifications@github.com wrote:
You need to do the transport to/from the client/server. The xterm.js demo
shows a basic example of thisโ
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/xtermjs/xterm.js/issues/1439#issuecomment-388403424,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANIVGAVvyI2bMuN3ei4-Og60QjnuGuTQks5txbJ3gaJpZM4T4Wg_
.
Study the demo like I said, that's a working example of a client/server setup https://github.com/xtermjs/xterm.js/tree/master/demo
I am already using this application and deployed it inside docker container
at http://code.golibrary.co. I think this demo doesn't suffice. What I want
is to send code from browser to this server running inside docker and
execute that code interactively inside the terminal on the link shared
above..
receiving data from browser is doable. But I am not clear how to execute
that code inside the terminal. As I said, term.write or writeln doesn't
work on execute commands..
Hope the query is clear to you ??
On Sat, May 12, 2018, 12:58 PM Daniel Imms notifications@github.com wrote:
Study the demo like I said, that's a working example of a client/server
setup https://github.com/xtermjs/xterm.js/tree/master/demoโ
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/xtermjs/xterm.js/issues/1439#issuecomment-388525217,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANIVGCo-9piSo1CUMrJ0t7-ZfTNn8yF7ks5txk_WgaJpZM4T4Wg_
.
The demo uses xterm to display and get input (client) and node-pty runs the process, accepting input and telling xterm what to display. Both have inputs and outputs which you need to hook up.
Tyriar already covered all of this but if it helps...
If your running _xterm.js_ inside docker then you're doing it wrong (or your design isn't obvious).
The demo doesn't use xterm on the server. It use's _node-pty_: https://github.com/pro-src/xterm.js/blob/master/demo/app.js#L31
The demo client's browser runs xterm.js and communicates with the server's node-pty via web-sockets.
So to be clear, the client(browser) uses xterm.write or xterm.writeln to display the output received from the server. However you choose to execute those commands on the server and send the output to the client is up to you, probably websockets.
The client would use xterm.on('data', listener) to know what to send to the server.
Good luck.
Thanks a lot. I am close to getting what I want !!
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
On Sat, May 12, 2018 at 9:48 PM, pro-src notifications@github.com wrote:
Tyriar already covered all of this but if it helps...
If your running xterm.js inside docker then your doing it wrong (or
your design isn't obvious).The demo doesn't use xterm on the server. It use's node-pty:
https://github.com/pro-src/xterm.js/blob/master/demo/app.js#L31The demo client's browser runs xterm.js and communicates with the server's
node-pty via web-sockets.So to be clear, the client(browser) uses xterm.write or xterm.writeln to
display the output received from the server. However you choose to execute
those commands on the server and send the output to the client is up to
you, probably websockets.The client would use xterm.on('data', listener) to know what to send to
the server.Good luck.
โ
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/xtermjs/xterm.js/issues/1439#issuecomment-388565877,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANIVGP4DpmRvG6TuFgu5Dej2pOM6MhO5ks5txwtHgaJpZM4T4Wg_
.
Glad to hear it! Please do keep in mind that Github issues isn't typically for Q/A or general help questions. Stackoverflow is though. I'm not saying that you can't ask questions here, just that this particular question is better suited for stackoverflow. If there's something _really_ missing from the demo, now that you've got things figured out, a new issue would be appropriate. This one has been closed for a minute :smile:
Yeah sure, thanks :)
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
On Sun, May 13, 2018 at 6:25 AM, pro-src notifications@github.com wrote:
Glad to hear it! Please do keep in mind that Github issues isn't typically
for Q/A or general help questions. Stackoverflow is though. I'm not saying
that you can't ask questions here, just that this particular question is
better suited for stackoverflow. If there's something really missing
from the demo, now that you've got things figured out, a new issue would be
appropriate. This one has been closed for a minute ๐โ
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/xtermjs/xterm.js/issues/1439#issuecomment-388593463,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANIVGLpa-ZxeEsexwknY0mYQ3Z-sNRYcks5tx4SNgaJpZM4T4Wg_
.
One more question . Does resizing the terminal or changing its position in
the existing demo, result in any errors ?
Using web socket I am sending commands to the terminal and it's failing at
below line from bundle.js
Terminal.prototype._bindKeys = function () {
this.on('refresh', function (data) { return
_this._queueLinkification(data.start, data.end); });
}
The error is "can't read property start of undefined". Why data is
undefined here ? Am I missing something obvious ?
Please elaborate more on this function and when this function is called !
Thanks,
Saurabh
โ
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
On Sun, May 13, 2018 at 10:56 AM, Saurabh Gattani
wrote:
Yeah sure, thanks :)
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&On Sun, May 13, 2018 at 6:25 AM, pro-src notifications@github.com wrote:
Glad to hear it! Please do keep in mind that Github issues isn't
typically for Q/A or general help questions. Stackoverflow is though. I'm
not saying that you can't ask questions here, just that this particular
question is better suited for stackoverflow. If there's something
really missing from the demo, now that you've got things figured out,
a new issue would be appropriate. This one has been closed for a minute
๐โ
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/xtermjs/xterm.js/issues/1439#issuecomment-388593463,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANIVGLpa-ZxeEsexwknY0mYQ3Z-sNRYcks5tx4SNgaJpZM4T4Wg_
.
This is fixed. Please ignore the previous query. Can you tell me how can I
get xterm instance on the server from terminal PID and then use that
terminal instance
to execute commands on server using term.writeln(
Thanks,
Saurabh
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
On Thu, May 17, 2018 at 5:32 AM, Saurabh Gattani saurabh.gattani@gmail.com
wrote:
One more question . Does resizing the terminal or changing its position in
the existing demo, result in any errors ?Using web socket I am sending commands to the terminal and it's failing at
below line from bundle.jsTerminal.prototype._bindKeys = function () {
this.on('refresh', function (data) { return _this._queueLinkification(data.start, data.end); });
}
The error is "can't read property start of undefined". Why data is
undefined here ? Am I missing something obvious ?Please elaborate more on this function and when this function is called !
Thanks,
Saurabhโ
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&On Sun, May 13, 2018 at 10:56 AM, Saurabh Gattani <
[email protected]> wrote:Yeah sure, thanks :)
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&On Sun, May 13, 2018 at 6:25 AM, pro-src notifications@github.com
wrote:Glad to hear it! Please do keep in mind that Github issues isn't
typically for Q/A or general help questions. Stackoverflow is though. I'm
not saying that you can't ask questions here, just that this particular
question is better suited for stackoverflow. If there's something
really missing from the demo, now that you've got things figured out,
a new issue would be appropriate. This one has been closed for a minute
๐โ
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/xtermjs/xterm.js/issues/1439#issuecomment-388593463,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANIVGLpa-ZxeEsexwknY0mYQ3Z-sNRYcks5tx4SNgaJpZM4T4Wg_
.
I have fixed this as well. Good to close this thread.
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
On Thu, May 17, 2018 at 9:50 PM, Saurabh Gattani saurabh.gattani@gmail.com
wrote:
This is fixed. Please ignore the previous query. Can you tell me how can I
get xterm instance on the server from terminal PID and then use that
terminal instance
to execute commands on server using term.writeln() ? Thanks,
Saurabh[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&On Thu, May 17, 2018 at 5:32 AM, Saurabh Gattani <
[email protected]> wrote:One more question . Does resizing the terminal or changing its position
in the existing demo, result in any errors ?Using web socket I am sending commands to the terminal and it's failing
at below line from bundle.jsTerminal.prototype._bindKeys = function () {
this.on('refresh', function (data) { return _this._queueLinkification(data.start, data.end); });
}
The error is "can't read property start of undefined". Why data is
undefined here ? Am I missing something obvious ?Please elaborate more on this function and when this function is called !
Thanks,
Saurabhโ
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&On Sun, May 13, 2018 at 10:56 AM, Saurabh Gattani <
[email protected]> wrote:Yeah sure, thanks :)
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4& Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&On Sun, May 13, 2018 at 6:25 AM, pro-src notifications@github.com
wrote:Glad to hear it! Please do keep in mind that Github issues isn't
typically for Q/A or general help questions. Stackoverflow is though. I'm
not saying that you can't ask questions here, just that this particular
question is better suited for stackoverflow. If there's something
really missing from the demo, now that you've got things figured
out, a new issue would be appropriate. This one has been closed for a
minute ๐โ
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/xtermjs/xterm.js/issues/1439#issuecomment-388593463,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANIVGLpa-ZxeEsexwknY0mYQ3Z-sNRYcks5tx4SNgaJpZM4T4Wg_
.
Most helpful comment
I have fixed this as well. Good to close this thread.
[image: Mailtrack]
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
Sender
notified by
Mailtrack
https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&
On Thu, May 17, 2018 at 9:50 PM, Saurabh Gattani saurabh.gattani@gmail.com
wrote: