gpt4 book ai didi

websocket - ejabberd 与 webclient (websocket.js) 连接失败

转载 作者:行者123 更新时间:2023-12-03 06:52:30 25 4
gpt4 key购买 nike

我已经使用 Ubunut 操作系统安装了 ejabberd。

  1. 将 ejabberd.yml 配置为:

    port: 5280
    ip: "::"
    module: ejabberd_http
    request_handlers:
    "/ws": ejabberd_http_ws
    "/bosh": mod_bosh
    "/a/b/": mod_foo
    "/api": mod_http_api
    web_admin: true
    http_bind: true
    register: true
    captcha: true
  2. 网络客户端:https://github.com/processone/xmpp-websocket-client

注意:也可以使用 jabber 客户端和 Spark 进行连接和聊天。

尝试与网络客户端连接,获取响应如下:

     client Request: <?xml version="1.0"?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0"
xmlns="jabber:client" to="localhost" xml:lang="en"
xmlns:xml="http://www.w3.org/XML/1998/namespace" >

Server Response: <stream:stream id='14754768778694635521' version='1.0' xml:lang='en'
xmlns:stream='http://etherx.jabber.org/streams' from='localhost'
xmlns='jabber:client'>

<stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism><mechanism>PLAIN</mechanism><mechanism>X-OAUTH2</mechanism></mechanisms></stream:features>

Client request: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/>

Server Response: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>bm9uY2U9IjE2NDY5ODExMTQ0NDkyMDQyMjQxIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>

Client Request: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dXNlcm5hbWU9Im1hbm9qIixyZWFsbT0iIixub25jZT0iMTY0Njk4MTExNDQ0OTIwNDIyNDEiLGNub25jZT0iZDQxZDhjZDk4ZjAwYjIwNGU5ODAwOTk4ZWNmODQyN2UiLG5jPSIwMDAwMDAwMSIscW9wPSJhdXRoIixkaWdlc3QtdXJpPSJ4bXBwL2xvY2FsaG9zdCIscmVzcG9uc2U9ImJhMjhjNTQwYzU5ZTczZGE1NGY1MmU2YjYxYTFhMjlmIixjaGFyc2V0PSJ1dGYtOCI=</response>

Server Response: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cnNwYXV0aD0xMzc3MzJjMzc3M2FhMjIxNzg0Y2RmYTIxY2RkNzZjMQ==</challenge>

CR: <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>

SR <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>

CR: <?xml version="1.0"?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" version="1.0"
xmlns="jabber:client" to="localhost" xml:lang="en"
xmlns:xml="http://www.w3.org/XML/1998/namespace" >

SR: <stream:stream id='2280662148453655041' version='1.0' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams'
xmlns='jabber:client'>

<stream:error><not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en'
xmlns='urn:ietf:params:xml:ns:xmpp-streams'>XML or text declaration
not at start of entity</text></stream:error>

</stream:stream>

服务器配置或 websocket.js 配置中缺少什么?

最佳答案

这只是 web-socket 客户端的问题,它使用旧的 web-socket 协议(protocol)版本,该版本在 xmpp over web-socket 标准化之前可用,我得到了新的更新的 web-socket 客户端,该客户端使用新协议(protocol),现在可以了。感谢 ejabberd 团队的更新。

关于websocket - ejabberd 与 webclient (websocket.js) 连接失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50543547/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com