mirror of
https://github.com/tsl0922/ttyd.git
synced 2026-02-23 18:34:26 +01:00
html: implement flow control for xterm
https://xtermjs.org/docs/guides/flowcontrol/#flow-control-over-websockets
This commit is contained in:
1096
src/html.h
1096
src/html.h
File diff suppressed because it is too large
Load Diff
@@ -383,6 +383,18 @@ int callback_tty(struct lws *wsi, enum lws_callback_reasons reason, void *user,
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case PAUSE:
|
||||
if (proc->state == STATE_INIT) {
|
||||
uv_read_stop((uv_stream_t *)&proc->pipe);
|
||||
proc->state = STATE_PAUSE;
|
||||
}
|
||||
break;
|
||||
case RESUME:
|
||||
if (proc->state == STATE_PAUSE) {
|
||||
uv_read_start((uv_stream_t *)&proc->pipe, alloc_cb, read_cb);
|
||||
proc->state = STATE_INIT;
|
||||
}
|
||||
break;
|
||||
case JSON_DATA:
|
||||
if (proc->pid > 0) break;
|
||||
if (server->credential != NULL) {
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
// client message
|
||||
#define INPUT '0'
|
||||
#define RESIZE_TERMINAL '1'
|
||||
#define PAUSE '2'
|
||||
#define RESUME '3'
|
||||
#define JSON_DATA '{'
|
||||
|
||||
// server message
|
||||
@@ -26,7 +28,7 @@ extern struct lws_context *context;
|
||||
extern struct server *server;
|
||||
extern struct endpoints endpoints;
|
||||
|
||||
typedef enum { STATE_INIT, STATE_KILL, STATE_EXIT } proc_state;
|
||||
typedef enum { STATE_INIT, STATE_PAUSE, STATE_KILL, STATE_EXIT } proc_state;
|
||||
|
||||
struct pss_http {
|
||||
char path[128];
|
||||
|
||||
Reference in New Issue
Block a user