Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
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 问问题
Uncaught TypeError: Object # has no method
Uncaught TypeError: Object # has no method 'distributeMessage'
after attempting to send a message.
Ideas?
I am creating a android app that uses a TCP socket to connect to a server. It continuously receives xml strings from this socket and I need to parse it as it comes. Currently I've implemented the socket in a service in the same process of the application.
I get outofmemory exception sometimes. The xml strings I receive will be around 1-3mb. My question is, will it be more efficient if a run my service in a separate process as my socket constantly needs to work? What is the best way to implement a socket in android which works the app life span?
原来这是 PaaS 不支持 websockets 的问题。解决方案只是通过以下方式显式禁用它们:
nowjs.initialize(server, {socketio: {transports: ['xhr-polling', 'jsonp-polling', 'htmlfile']}});
(在#nowjs IRC 中解决)
我们很难知道这么少的信息。如果您发布代码,我们更有可能知道发生了什么。
查看 nowjs.com 网站上的 hello world 演示,看起来helloworld_server.js您的页面中可能没有包含该文件,因为这distributeMessage()是定义函数的地方。
helloworld_server.js
distributeMessage()
在这里的演示文件中,helloworld.html 有这一行:
<script src="http://localhost:8080/nowjs/now.js"></script>
但是,演示 tgz 文件不包括该文件。您可能now.js在适当的路径中丢失了。
now.js