0

I downloaded the example project from Now.js http://nowjs.com/guide and when I run it I get

Uncaught TypeError: Object # has no method 'distributeMessage'

after attempting to send a message.

Ideas?


It's hard for us to know with so little information. If you post your code, we are more likely to know what's going on.

Looking at the hello world demo on the nowjs.com site, it looks like maybe you don't have the helloworld_server.js file included in your page because that's where the distributeMessage() function is defined.

In the demo files here, helloworld.html has this line:

<script src="http://localhost:8080/nowjs/now.js"></script>

But, the demo tgz file doesn't include that. You are probably missing now.js in an appropriate path.

4

2 に答える 2

4

PaaSがWebSocketをサポートしていないという問題であることが判明しました。解決策は、次のような方法で明示的に無効にすることでした。

nowjs.initialize(server, {socketio: {transports: ['xhr-polling', 'jsonp-polling', 'htmlfile']}});

(#nowjs IRCで解決)

于 2011-08-13T22:27:30.357 に答える
0

これだけの情報で知ることは困難です。コードを投稿していただければ、何が起こっているのかを知ることができます。

nowjs.com サイトの hello world デモを見ると、関数が定義されhelloworld_server.jsているページにファイルが含まれていないように見えます。distributeMessage()

こちらのデモ ファイルでは、helloworld.html に次の行があります。

<script src="http://localhost:8080/nowjs/now.js"></script>

ただし、デモの tgz ファイルにはそれが含まれていません。おそらくnow.js適切なパスがありません。

于 2011-08-13T07:22:35.740 に答える