English 中文(简体)
页: 1 io没有向Nude服务器发送有关 Chrome和 Firefox升的信息。
原标题:Socket.io fails to emit messages to Node server on Chrome & Firefox

我现在试图说明一下我的法律/环境现在的错误。 基本上,我想向服务器发出客户信息。 以下所有浏览器的工作FF(11)和chrome(18.0.1025.152米)除外。

这里有一些信息:

  1. I run Node.js on Windows 7 enterprise 64-bit machine
  2. I use apache to serve the page from localhost
  3. I m listening on port 8080 with socket.io
  4. It looks like chrome and FF fallback to xhr-polling / jsonp-polling instead of using sockets
  5. 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): enter image description here

chrome XHR request: enter image description here

<>Update>: Iv e 加入

socket.on( connect , function () {
     console.log("connected");
});

它从未向神学院开火。

因此,什么可能是错误的? 请帮助:

问题回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jQuery block moving

I wanna move a div block to the top, so I coded like this: CSS part: .movingPart{ margin-top:80px; } jQuery part: $(document).ready(function() { $( #btn ).click(function() { $( .movingPart )....

Private FireFox plugin

I m looking at getting a FireFox plugin developed - but is it possible to create a plugin that is for private use only, so only those I share it with have it and not open to the masses? Need this for ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Cross-browser development

I m developing a web application for a new service, starting from Firefox 3.5. The interface design is tableless, only using divs + CSS & performance-blessed practices. Now, while being ...

Cross browser way of setting IFrame to "about:blank"?

Does anybody know a proper, cross-browser way to "empty" an IFrame? Is "about:blank" recognized without error across all browsers? Is it valid to give an IFrame an empty src?

热门标签