aleksplus / ajaxterm-ws

DEPRECATED. WebSocket fork of @kohsuke version.

Home Page:http://ajaxterm4j.kohsuke.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DEPRECATED

Do not use in new projects.

Fork of @kohsuke/ajaxterm4j version, replaced ajax with WebSocket.

Original author Antony Lesuisse Ajaxterm.

Ajaxterm was written by Antony Lesuisse (email: al AT udev.org), License Public Domain.

Usage

Specify WebSocket endpoint

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Terminal</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" type="text/css" href="index.css">
    <script src="index.js"></script>
</head>
<body style="background-color:#888">
<div id="term" class="ajaxterm"></div>
<script>
    window.onload = function () {
        function getEndpoint() {
            const loc = document.location;
            const host = loc.hostname;
            const port = loc.port;
            const ws_protocol = loc.protocol === 'https:' ? 'wss' : 'ws';
            return `${ws_protocol}://${host}:${port}/`
        }

        ajaxterm.terminal('term', {
            width: window.innerWidth,
            height: window.innerHeight,
            getEndpoint: getEndpoint
        });
    };
</script>
</body>
</html>

About

DEPRECATED. WebSocket fork of @kohsuke version.

http://ajaxterm4j.kohsuke.org/

License:Creative Commons Zero v1.0 Universal


Languages

Language:JavaScript 86.2%Language:CSS 13.8%