我现在试图说明一下我的法律/环境现在的错误。 基本上,我想向服务器发出客户信息。 以下所有浏览器的工作但FF(11)和chrome(18.0.1025.152米)除外。
这里有一些信息:
- I run Node.js on Windows 7 enterprise 64-bit machine
- I use apache to serve the page from localhost
- I m listening on port 8080 with socket.io
- It looks like chrome and FF fallback to xhr-polling / jsonp-polling instead of using sockets
- I can push messages from the server, but I can t emit from the client
服务器代码:
var io = require( C:/Users/shlomis/node_modules/socket.io/lib/socket.io ).listen(8080);
io.sockets.on( connection , function (socket) {
socket.on( my event , function (msg) {
console.log("DATA!!!");
});
});
www.un.org/spanish/ecosoc 我找不到一条没有一条完整道路的通道。
客户代码:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello World!</title>
<meta charset="utf-8">
<script src="http://localhost:8080/socket.io/socket.io.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var socket = io.connect( http://localhost:8080 );
$("#button").click(function() {
socket.emit( my event ,"Hello World!");
})
})
</script>
</head>
<body>
<button type="button" id= button >Send Message</button>
</body>
</html>
模块版本:
C:Usersshlomis>npm ls
[email protected] C:Usersshlomis
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
└─┬ [email protected]
├── [email protected]
├── [email protected]
└─┬ [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
└── [email protected]
日志:
C:Usersshlomis>node C:devwampwwwARjsvideoServer.js
info - socket.io started
debug - served static content /socket.io.js
debug - client authorized
info - handshake authorized 17502185141066845391
debug - setting request GET /socket.io/1/websocket/17502185141066845391
debug - set heartbeat interval for client 17502185141066845391
debug - client authorized for
debug - websocket writing 1::
debug - setting request GET /socket.io/1/xhr-polling/17502185141066845391?t=1334041653716
debug - setting poll timeout
debug - discarding transport
debug - cleared heartbeat interval for client 17502185141066845391
chrome WS request (101 Switching Protocols):
chrome XHR request:
<>Update>: Iv e 加入
socket.on( connect , function () {
console.log("connected");
});
它从未向神学院开火。
因此,什么可能是错误的? 请帮助: