I am currently developing an instant messaging feature for my apps (ideally cross platform mobile app/web app), and I am out of ideas to fix my issue. So far, I have been able to make everything work locally, using a Node.js server with socket.io, django, and redis, following what most tutorials online suggest. The step I am now at consists in putting all that in the cloud using amazon AWS. My Django server is up and running, I created a new separate Node.js server, and I am using Elasticache to handle the Redis part. I launch the different parts, and no error shows up. However, whenever I try using my messaging feature on the web, I keep getting an error 500:
我目前正在为我的应用程序开发即时消息功能(理想情况是跨平台移动应用程序/网络应用程序),而且我没有想法解决我的问题。到目前为止,我已经能够使用带有socket.io,django和redis的Node.js服务器在本地工作,遵循大多数教程在线建议。我现在所采取的步骤包括使用amazon AWS将所有这些内容放入云端。我的Django服务器启动并运行,我创建了一个新的独立Node.js服务器,我使用Elasticache来处理Redis部分。我启动了不同的部分,没有出现错误。但是,每当我尝试在网络上使用我的消息功能时,我都会收到错误500:
handshake error
握手错误
I then used the console to check the request header, and I observed that the cookies are not in there, contrary to when I am on localhost. I know it is necessary to authorize the handshake, so I guess that's where my error is coming from..
然后我使用控制台检查请求标头,我发现cookie不在那里,这与我在localhost上的情况相反。我知道有必要授权握手,所以我想这就是我的错误来自......
Furthermore, I have also checked that the cookies do exist, they are just not set in the request header.
此外,我还检查过cookie确实存在,它们只是没有在请求头中设置。
My question is then: How can I make sure Django or socket client (not sure who's responsible here..) puts the cookies in the header??
我的问题是:如何确保Django或套接字客户端(不确定谁在这里负责..)将cookie放入标题?
One of my ideas was that maybe I am supposed to put everything on the same server, with different ports, instead of 2 separate servers? Documentation on that specific architecture problem is surprisingly scarce, compared to the number of tutorials describing how to make it work on local.
我的一个想法是,我可能应该将所有内容放在同一台服务器上,使用不同的端口,而不是两*立的服务器?与描述如何使其在本地工作的教程的数量相比,关于该特定体系结构问题的文档令人惊讶地稀缺。
I hope I described the problem accurately enough! :)
我希望我能够准确地描述问题! :)
Important note: I am using socket.io v0.9.1-1, only one compatible with a titanium mobile app.
重要说明:我使用的是socket.io v0.9.1-1,只有一个与钛移动应用程序兼容。
Thank you for any help!
感谢您的任何帮助!
1 个解决方案
#1
1
All right, so I've made some progress. The cookie problem came from the fact I was making cross-domain request, adding a few lines enabled CORS, which didn't solve the cookie issue, but allowed me to communicate between servers (basically I set the headers of the response using express
. I then passed necessary data in the query, even if not the most secure way to do it, I'm just building an MVP, and it's enough for now.
好的,所以我取得了一些进展。 cookie问题来自于我正在进行跨域请求,添加了几行启用CORS,这没有解决cookie问题,但允许我在服务器之间进行通信(基本上我使用express设置响应的头部。然后我在查询中传递了必要的数据,即使不是最安全的方法,我只是建立一个MVP,现在已经足够了。
I haven't been able to make the chat work from my Titanium mobile app, but since I can use a webview to handle it, I will be fine.
我无法通过我的Titanium移动应用程序进行聊天工作,但由于我可以使用webview来处理它,我会没事的。
Hopefully that will help someone.. If anyone needs me to post some code snippets I will gladly do so upon request!
希望这会有所帮助..如果有人需要我发布一些代码片段,我很乐意根据要求这样做!
Cheers
干杯
#1
1
All right, so I've made some progress. The cookie problem came from the fact I was making cross-domain request, adding a few lines enabled CORS, which didn't solve the cookie issue, but allowed me to communicate between servers (basically I set the headers of the response using express
. I then passed necessary data in the query, even if not the most secure way to do it, I'm just building an MVP, and it's enough for now.
好的,所以我取得了一些进展。 cookie问题来自于我正在进行跨域请求,添加了几行启用CORS,这没有解决cookie问题,但允许我在服务器之间进行通信(基本上我使用express设置响应的头部。然后我在查询中传递了必要的数据,即使不是最安全的方法,我只是建立一个MVP,现在已经足够了。
I haven't been able to make the chat work from my Titanium mobile app, but since I can use a webview to handle it, I will be fine.
我无法通过我的Titanium移动应用程序进行聊天工作,但由于我可以使用webview来处理它,我会没事的。
Hopefully that will help someone.. If anyone needs me to post some code snippets I will gladly do so upon request!
希望这会有所帮助..如果有人需要我发布一些代码片段,我很乐意根据要求这样做!
Cheers
干杯