【问题标题】:ejabberd: Why is Websocket connection not openingejabberd:为什么Websocket连接没有打开
【发布时间】:2016-03-22 10:52:21
【问题描述】:

我正在尝试建立从 Strophe.js 到 Ejabberd 的 websocket 连接,但 ejabberd 无法建立 websocket 连接。

详情如下:

ejabberd 版本:16.02

Web 套接字标头

一般

Request URL:ws://localhost:5280/websocket
Request Method:GET
Status Code:101 Switching Protocols

响应标头

Connection:Upgrade
Sec-WebSocket-Accept:BHzI4XS3kPDZJhNt4BVAaGDvv8I=
Sec-Websocket-Protocol:xmpp
Upgrade:websocket

请求标头

Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:Upgrade
Host:localhost:5280
Origin:http://localhost
Pragma:no-cache
Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits
Sec-WebSocket-Key:eErMAKwTSckMghBGWY3KtQ==
Sec-WebSocket-Protocol:xmpp
Sec-WebSocket-Version:13
Upgrade:websocket
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36

Ejabberd websocket 配置

port: 5280
module: ejabberd_http
request_handlers:
  "/websocket": ejabberd_http_ws
##  "/pub/archive": mod_http_fileserver
web_admin: true
http_bind: true
## register: true
captcha: false

ejabberd 日志

2016-03-22 15:32:46.765 [info] <0.438.0>@ejabberd_listener:accept:333 (#Port<0.16207>) Accepted connection 127.0.0.1:57946 -> 127.0.0.1:5280
2016-03-22 15:32:46.766 [info] <0.1283.0>@ejabberd_http:init:158 started: {gen_tcp,#Port<0.16207>}
2016-03-22 15:32:46.777 [error] <0.1286.0>@ejabberd_hooks:run_fold1:368 {{badmatch,[<<"localhost">>]},[{mod_pubsub,serverhost,1,[{file,"src/mod_pubsub.erl"},{line,4012}]},{mod_pubsub,plugins,1,[{file,"src/mod_pubsub.erl"},{line,4038}]},{mod_pubsub,features,2,[{file,"src/mod_pubsub.erl"},{line,4116}]},{mod_pubsub,disco_local_features,5,[{file,"src/mod_pubsub.erl"},{line,512}]},{ejabberd_hooks,safe_apply,3,[{file,"src/ejabberd_hooks.erl"},{line,382}]},{ejabberd_hooks,run_fold1,4,[{file,"src/ejabberd_hooks.erl"},{line,365}]},{mod_caps,make_my_disco_hash,1,[{file,"src/mod_caps.erl"},{line,515}]},{mod_caps,caps_stream_features,2,[{file,"src/mod_caps.erl"},{line,188}]}]}
running hook: {disco_local_features,[{jid,<<>>,<<"localhost">>,<<>>,<<>>,<<"localhost">>,<<>>},{jid,<<>>,<<"localhost">>,<<>>,<<>>,<<"localhost">>,<<>>},<<>>,<<>>]}

请帮助我了解 ejabberd 日志以及如何使客户端成功连接到 ejabberd。

【问题讨论】:

    标签: websocket chat publish-subscribe ejabberd


    【解决方案1】:

    这似乎与 Websockets 无关,但您似乎遇到了一个已在 ejabberd 存储库中修复的错误,该错误将被打包为 16.03。

    如果您从 ejabberd 存储库更新到最新的 HEAD,它应该可以解决您的 pubsub 崩溃问题。

    你可以在这里找到它:https://github.com/processone/ejabberd

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-10
      • 2012-02-04
      相关资源
      最近更新 更多