【发布时间】:2014-09-14 15:15:33
【问题描述】:
我正在开发一个聊天程序,我仍在开始制作它,但是当我尝试从谷歌浏览器上的控制台连接到服务器时,它说参考错误 io 未定义。
客户
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>Chat</title>
</head>
<body>
<div class="chat">
<input type="text" class="chat-name" placeholder="Enter your name">
<div class="chat-messages">
<div class="chat-message">
</div>
</div>
<textarea placeholder="type your message" class="chat-textarea"></textarea>
<div class="chat-status">Status: <span>Idle</span></div>
</div>
<script>src="http://localhost:8080/socket.io/socket.io.js"</script>
</body>
</html>
server.js
var mongo = require('mongodb').MongoClient,
client = require('socket.io').listen(8080);
console.log("Server is running on port 8080");
【问题讨论】:
-
我没有在任何地方使用变量
io。这是你的完整代码吗?
标签: javascript html node.js mongodb socket.io