Socket.io官方聊天应用程序无法在Firebase上运行 [英] Socket.io Official Chat application not work on firebase

查看:63
本文介绍了Socket.io官方聊天应用程序无法在Firebase上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Firebase上部署了 Socket.io官方聊天应用程序,但它始终显示https控制台中的://://.firebaseapp.com/socket.io/[找不到HTTP/1.1 404].如何解决这个问题?而且它可以在我的本地计算机上运行 http://localhost:3000

I deploy the Socket.io Official Chat application on Firebase, but it always show https://.firebaseapp.com/socket.io/ [HTTP/1.1 404 Not Found] in the console. How to fix this problem?? And It works on my local machine http://localhost:3000

我应该更改var http = require('http').Server(app);到 var http = require('https').Server(app); 因为Firebase托管仅使用SSL.

Should I change var http = require('http').Server(app); to var http = require('https').Server(app); Because Firebase Hosting is SSL-only.

任何帮助将不胜感激.最好的问候.

Any help would be much appreciated. Best Regards.

推荐答案

Firebase托管仅适用于静态资产.您不能在其服务器上运行自己的节点脚本.这意味着无法在Firebase Hosting上运行socket.io聊天应用程序.

Firebase Hosting is for static assets only. You cannot run your own node scripts on its servers. This means there is no way to run the socket.io chat app on Firebase Hosting.

有趣的事实:Firebase还提供了一个实时数据库,可用于非常轻松地构建聊天应用程序.看看交互式教程可以了解一下.

Fun fact: Firebase also offers a real-time database, which can be used to very easily build a chat application. Have a look at the interactive tutorial to get a feel for it.

这篇关于Socket.io官方聊天应用程序无法在Firebase上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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