【问题标题】:Why Client don't connect to Server?为什么客户端不连接到服务器?
【发布时间】:2018-07-07 06:31:24
【问题描述】:

我启动了 UrbanCode Deploy 服务器。 我在相同的硬件上安装了代理。 代理不连接:

连接到 wss://localhost:7918 TCP连接完成:сhannel=8e24500b uri=wss://localhost:7918 connection=127.0.0.1:60981->127.0.0.1:718 SSL 握手完成:ch=8e24500b local=/127.0.0.1:60981 remote=localhost/127.0.0.1:7918 proto=TLSv1.2 cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 peer=CN=mycomp pubkey fp=1C.....8E 从磁盘加载 pin 证书:file=c:\agent\public-keys\localhost.crt 在 3000 毫秒内重新连接

服务器:

传输连接到:tcp://127.0.0.1:60981 失败

如果我更改端口,则没有任何连接,所以端口 7918 - 正确。 如果我删除 .crt 文件,那么代理会再次创建它并加载,因此路径和权限是正确的。

Windows 10。

【问题讨论】:

  • 我觉得你的需求需要JS或者jQuery的支持
  • 这不是 PHP 的本意。正如@Sinto 所说,您将需要使用 JS 或 JQuery。
  • 你是对的。更正了问题标签
  • 您只需要在按下Esc 时切换一个布尔变量并使用if 语句在PgUp/PgDown 键触发事件时检查它,您正在使用@ 监听987654324@.
  • 我明白了。我的主要问题是如何滚动到下一个突出显示的短语(我想我也需要替换短语中的空格)

标签: javascript html


【解决方案1】:

花了我一段时间来写,但这是我能想到的最好的。它不是 100% 完美的(在上下滚动之间切换需要 2 次按键),但除此之外它可以按预期工作。代码cmets中的解释:

function handleKeyPress(event){
    // Prevent default browser action on PageUp, PageDown, ArrowUp, ArrowDown and Esc
    if([27, 33, 34, 38, 40].indexOf(event.keyCode) > -1) {
        event.preventDefault();
    }
    // Get key name
    const keyName = event.key;

    // Scrolling up
    if(keyName === 'PageUp' || keyName === 'ArrowUp'){
        // First anchor detected
        if(currAnchor === 0){
            return false;
        } else {
            currAnchor--;
            location.hash = anchorLinks[currAnchor].id;
        }
    } else if(keyName === 'PageDown' || keyName === 'ArrowDown'){
        if(currAnchor <= lastAnchor){
            location.hash = anchorLinks[currAnchor].id;
            currAnchor++;
        // Last anchor detected
        } else {
            return false;
        }
    } else if(keyName === 'Escape'){
        // Remove the event listener
        document.removeEventListener('keypress', handleKeyPress, true);
    }
}

// Get all divs (just an example. Best to use a class to only select what you need)
const anchorLinks = document.getElementsByTagName("div");
// Get last index of array
const lastAnchor = anchorLinks.length;
// Current anchor position
let currAnchor = 0;

// Add event listener for keypress
document.addEventListener('keypress', handleKeyPress, true);

【讨论】:

  • 我现在尝试测试 :-) 稍后见。
  • @J.Doe 请确保选中解决您问题的答案旁边的复选标记。这是一种向帮助您的人表示感谢的方式,并确保您的问题不会永远无人回答。这不一定是我的答案。这只是对 Stack Overflow 工作原理的解释,因为您似乎是新来的。
  • 好的,我会检查的。你能解释一下我应该如何在 HTML 中获取锚点吗?我应该接受
    的锚点吗?
  • @J.Doe 我认为元素并不重要。只是 id 可以。
  • 感谢支持!请看起来像我解决了部分任务。我更正了我的问题。
猜你喜欢
相关资源
最近更新 更多
热门标签