Comments (5)
Hey Tom,
We've added the clientWrite option which allows you to stop clients from writing to the server.
nowjs.initialize(httpServer, {clientWrite: false});
However changes are rejected on the server side so it is important to make sure that any type of data sent to the server is rejected if it surpasses a certain size
from now.
Sweet, it does seem like a big security issue with having clientWrite as true.
So with:
nowjs.initialize(httpServer, {clientWrite: false});
What's the best practice equivalent of:
now.receiveMessage = function(name, message){
$("#messages").append("<br>"+name+": "+message);
}
I couldn't get the following to work:
Server:
/**
* Meet the client
* @return {integer} id
*/
everyone.now.meet = function(options,_callback){
// Apply Options
if ( typeof options.notify === 'function' ) {
this.now.notify = options.notify;
}
// Next
_callback(this.now.id);
};
// ...
everyone.now.notify(n);
Client:
// Now
window.now.ready(function(){
// Bind Now
window.now.meet(
// Options
{
notify: function(_state){
if ( _state !== me.currentState ) {
me.reset();
}
}
},
// Callback
function(_id){
// Apply Id
document.title = me.id = _id;
// Init Sync
me.reset();
}
);
});
Returns error on server:
TypeError: Object #<Object> has no method 'notify'
at Object.<anonymous> (/Users/balupton/Dropbox/Server/public_html/sites/nowpad/server.js:180:16)
at Object.<anonymous> (native)
at Object.remoteCall (/usr/local/lib/node/.npm/now/0.5.2/package/lib/nowServerLib.js:49:19)
at [object Object].<anonymous> (/usr/local/lib/node/.npm/now/0.5.2/package/lib/nowServerLib.js:173:46)
at [object Object].emit (events.js:64:17)
at [object Object]._onMessage (/usr/local/lib/node/.npm/socket.io/0.6.17/package/lib/socket.io/client.js:58:10)
at Parser.<anonymous> (native)
at Parser.emit (events.js:64:17)
at Parser.parse (/usr/local/lib/node/.npm/socket.io/0.6.17/package/lib/socket.io/transports/websocket.js:195:12)
at Parser.add (/usr/local/lib/node/.npm/socket.io/0.6.17/package/lib/socket.io/transports/websocket.js:182:8)
from now.
Hmm I believe there is an outstanding bug with nested functions being passed as parameters. So options.notify is not being actually passed the server
from now.
Yeah, passing the notify function as an argument rather than inside an object worked great. Would you like me to file a bug for sending objects to the server?
from now.
Yep that'd be very helpful, thanks!
On Sun, Apr 24, 2011 at 8:32 PM, balupton <
[email protected]>wrote:
Yeah, passing the notify function as a argument rather than inside an
object worked great. Would you like me to file a bug for sending objects to
the server?Reply to this email directly or view it on GitHub:
#44 (comment)
510-691-3951
EECS Student at UC Berkeley
http://ericzhang.com
from now.
Related Issues (20)
- installation fail :( HOT 3
- Can not read the property of 'ressource' undefined HOT 1
- No dev in six months. What is the future of NowJS? HOT 13
- Now module Installation failed ..... throwing error in windows
- npm install now ..... throwing error HOT 1
- Not working with Dojo due to Socket.io-client
- Implementing chat module by using Nowjs HOT 6
- now.js and node autocluster core module
- Issue in limit of sending message in chat
- /nowjs/now.js ??
- website HOT 7
- Connecting to nodejs on http from https site HOT 1
- cannot finde module '../build/Release/nodeproxy.node'
- iOS app crashed in release mode while using Nowjs library
- Now doesn't work with latest sockets.io HOT 2
- Does not work with angular-cli: content.charCodeAt is not a function
- possible spam HOT 1
- Error: Cannot find module 'now' HOT 3
- Error: Cannot find module 'now'
- http://www.nowjs.com is not correct HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from now.