ejabberd:为什么Websocket连接无法打开 [英] ejabberd: Why is Websocket connection not opening

查看:112
本文介绍了ejabberd:为什么Websocket连接无法打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to make a websocket connection from Strophe.js to Ejabberd but ejabberd is not able to make a websocket connection.

以下是详细信息:

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连接。

Please help me out to understand the ejabberd log and how can I make the successful websocket connection from client to ejabberd.

推荐答案

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

It seems this is not related to Websockets, but you seem to have hit a bug that is already fix in ejabberd repository and that will be packaged as 16.03.

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

If you update to latest HEAD from ejabberd repository, it should solve your pubsub crash issue.

您可以在此处找到它: https://github.com/processone/ejabberd

You can find it here: https://github.com/processone/ejabberd

这篇关于ejabberd:为什么Websocket连接无法打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆