question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can xterm attach use socket. io?

See original GitHub issue

import * as Terminal from 'xterm';
import * as attach from 'xterm/lib/addons/attach/attach';

Terminal.applyAddon(attach);  // Apply the `attach` addon

var term = new Terminal();
var socket = new WebSocket('wss://docker.example.com/containers/mycontainerid/attach/ws');

term.attach(socket);  // Attach the above socket to `term`

I don’t want to use websocket directly

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:63 (28 by maintainers)

github_iconTop GitHub Comments

2reactions
jerchcommented, Mar 16, 2019

@BengBu-YueZhang Possible, but you will have to provide your own attach functionality. Under the hood the terminal object has a write method, that needs to be glue’d to whatever output API you use. For the reverse case simply attach the ‘data’ event to your interface’s input sink. Both directions currently operate on JS strings. For more info see https://github.com/xtermjs/xterm.js/blob/master/src/addons/attach/attach.ts

1reaction
jerchcommented, Aug 9, 2019

Sweet, good luck with your project 😸

Read more comments on GitHub >

github_iconTop Results From Across the Web

powerumc/xterm-addon-attach-socketio - GitHub
xterm-addon-attach-socketio. It's used socket.io server and client without origin WebSocket. Installation. npm install xterm-addon-attach-socketio. Demo.
Read more >
How to create web-based terminals - Sai Sandeep Vaddi
All we have to do now is, create a terminal with xterm and attach it to a container in dom. Then, pass input...
Read more >
Stream interactive shell session with socket.io - Stack Overflow
io-client to connect to socket.io server. Starts interactive shell session using node-pty . const io = require('socket.io-client ...
Read more >
Top 5 xterm-addon-attach Code Examples - Snyk
Learn more about how to use xterm-addon-attach, based on xterm-addon-attach code examples created from the most popular ways it is used in public...
Read more >
billchurch/webssh2: Web SSH Client using ssh2, socket.io ...
Web SSH Client using ssh2, socket.io, xterm.js, and express. webssh webssh2. ... You will be prompted for credentials to use on the SSH...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found