我正在尝试从Strophe.js到Ejabberd进行websocket连接,但是ejabberd无法建立websocket连接。
以下是详细信息:
ejabberd版本:16.02
网络套接字标题
一般
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日志,如何成功地将webocket连接从客户端连接到ejabberd。
答案 0 :(得分:1)
这似乎与Websockets无关,但您似乎遇到了一个已在ejabberd存储库中修复的错误,该错误将打包为16.03。
如果您从ejabberd存储库更新到最新的HEAD,它应该解决您的pubsub崩溃问题。
您可以在此处找到它:https://github.com/processone/ejabberd