Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linux-china/xterm-demo
Xterm.js with RSocket
https://github.com/linux-china/xterm-demo
rsocket spring-boot spring-shell xtermjs
Last synced: 11 days ago
JSON representation
Xterm.js with RSocket
- Host: GitHub
- URL: https://github.com/linux-china/xterm-demo
- Owner: linux-china
- Created: 2020-01-14T21:56:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-01T15:23:22.000Z (almost 2 years ago)
- Last Synced: 2023-03-10T21:34:29.439Z (over 1 year ago)
- Topics: rsocket, spring-boot, spring-shell, xtermjs
- Language: JavaScript
- Homepage:
- Size: 787 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Xterm.js demo with Spring Boot RSocket
======================================
[![Build Status](https://api.travis-ci.com/linux-china/xterm-demo.svg?branch=master)](https://travis-ci.com/linux-china/xterm-demo)A web terminal with following tech stack:
* Xterm.js to render terminal in browser
* Input commands to be executed on the backend(Spring Boot + RSocket)
* Spring Shell command model to write your commands
* RSocket protocol: communication between browser and backend
* xterm-addon-rsocket
* Web Components for XtermIf you want to use Xterm.js in your Spring Boot app, please use https://github.com/linux-china/xtermjs-spring-boot-starter
# How to run?
```
$ mvn compile spring-boot:run
```Then visit [http://localhost:8080/index.html](http://localhost:8080/index.html) and screenshot alike following:
![Xterm Screenshot](.README_images/xterm_screenshot.png)
# How to write my command?
You just need to write standard ShellComponent of Spring Shell, and example as following:
```java
@ShellComponent
public class MyCommands {@ShellMethod("Add two integers together.")
public int add(int a, int b) {
return a + b;
}@ShellMethod("Minus two integers together.")
public int minus(int a, int b) {
return a - b;
}
}
```**Attention:** You can choose Picocli to build commands also https://github.com/remkop/picocli/tree/master/picocli-spring-boot-starter
# Use Cases
* mysql/redis-cli CLI in browser
* App Info Viewer: configuration, refresh etc
* Metrics Query
* JVM info: thread, heap etc
* Call functions on FaaS platform`# References
* Xterm.js: https://xtermjs.org/
* Xterm.js addons: https://www.npmjs.com/search?q=xterm%20addon
* Spring Boot RSocket: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-rsocket
* Spring Shell docs: https://docs.spring.io/spring-shell/docs/2.0.0.RELEASE/reference/htmlsingle/