Websockets出现400、502、503错误 [英] 400, 502, 503 errors with Websockets

查看:2772
本文介绍了Websockets出现400、502、503错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Socket.io,Node.js和Openshift制作多人游戏.它工作了一段时间,但我做了一些小改动,但现在与我所做的更改无关的东西坏了.当第二位玩家尝试加入游戏时,它将引导所有人退出,对网站上的其他任何人都显示503错误.对于第二个玩家,我遇到了很多控制台错误,包括

I am making a multiplayer game using Socket.io, Node.js, and Openshift. It was working for a while, but I made a few small changes and now something unrelated to what I changed has broken. When a second player tries to join the game, it boots everyone out, showing a 503 error for anyone else who goes on the site. For the second player, I get a lot of console errors including

WebSocket connection to 'ws://avalon-evao.rhcloud.com/socket.io/?EIO=3&transport=websocket&sid=d5smykffy4EWHxgIAAAC' failed: Error during WebSocket handshake: Unexpected response code: 400

http://avalon-evao.rhcloud.com/socket.io/?EIO=3&transport=polling&t=1421020862973-4&sid=d5smykffy4EWHxgIAAAC Failed to load resource: the server responded with a status of 502 (Bad Gateway)

http://avalon-evao.rhcloud.com/socket.io/?EIO=3&transport=polling&t=1421020865831-6&sid=d5smykffy4EWHxgIAAAC Failed to load resource: the server responded with a status of 503 (Service Unavailable)

socket.io-1.2.0.js:2 WebSocket connection to 'ws://avalon-evao.rhcloud.com/socket.io/?EIO=3&transport=websocket&sid=c-fwcJaMkp_9rl5CAAAA' failed: WebSocket is closed before the connection is established.

它在localhost上运行正常,但实际站点已损坏.

It works perfectly fine in localhost, but the real site is broken.

这是我尝试过的:

  1. 使用HTTPS.我仍然仍然会收到502错误.
  2. 使用rhc app restart
  3. 重新启动应用
  4. 使用rhc app force-stop rhc app start
  5. 重新启动应用
  6. 检查内存限制.我还没打.
  7. 使用{ secure: true }选项安全地连接到Websocket
  1. Using HTTPS. I still somehow get the 502 error.
  2. Restarting the app using rhc app restart
  3. Restarting the app using rhc app force-stop rhc app start
  4. Checking the memory limit. I haven't hit it.
  5. Connecting to websockets securely using the { secure: true } option

是什么原因导致这些错误,我该如何解决?

What is causing these errors and how can I fix them?

推荐答案

尝试:
ws://...rhcloud.com:8000/socket.io/...
wss://...rhcloud.com:8443/socket.io/...

Try:
ws://...rhcloud.com:8000/socket.io/...
wss://...rhcloud.com:8443/socket.io/...

https: //help.openshift.com/hc/zh-CN/articles/203263674-What-external-ports-are-available-on-OpenShift

这篇关于Websockets出现400、502、503错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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