如何解决socket.io 未在 aws 服务器中连接
我有 node js express 项目。 我正在为聊天应用程序实现 socket.io。 要检查套接字连接,我正在使用此工具。 https://amritb.github.io/socketio-client-tool/
这是我的服务器代码。
location /hiyup_dev/ {
proxy_pass http://localhost:3001/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
我使用上述工具检查了连接。像 http://localhost:3000,和套接字连接。 但是当我在服务器中检查它时,它不起作用。
我在服务器中使用 ngnix 服务器并映射我的端口,我正在做反向代理
def ConvertToExcelView(request):
details = request.GET.get('s_details') #Assuming the form name is s_details
queryset = (Q(student__klass__name__exact = details))
response = HttpResponse(content_type='text/csv')
writer = csv.writer(response)
writer.writerow([('name'),('adm'),('form'),('stream') ])
for member in Marks.objects.filter(queryset).distinct().filter(student__school__name=request.user.school).values_list('student__name','student__adm','student__klass__name','student__stream__name':
writer.writerow(member)
response['Content-Disposition'] = 'attachment; filename="members.csv"'
return response
我检查过 http://example.com/hiyup_dev(它将指向端口 3001)它不工作。
然后我在入站 aws 规则中添加了我的端口。 然后我检查了一下 http://myip:3001 它也不起作用。
我在这里缺少什么。它在本地而不是服务器中工作正常。 :(
解决方法
客户端(swift)集成的问题。它仅支持套接字版本 2+/3+。所以我将服务器套接字版本从 4 降级到 3。然后我就成功了。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。