4 ms·
Meteor chat app
- nicklovescode 14y agoHaving used Meteor for a few weeks, I'm always impressed with how much time it is saving me. One of the unfortunate things about Meteor at the moment is there aren't many open projects to learn from. For others trying to gain insights to best practices through this projects, here are some suggestions I may offer: Users.find({last_seen: {$lt: (now - 60 * 1000)}}).forEach(function (user) { Users.remove(user._id); }); -> Users.remove({ last_seen: { $lt: (now - 60 * 1000) } }); and Messages.find({date: {$gt: new Date()}}).forEach(function (message) { Messages.update(message._id, {$set: {date: new Date()}}); }); -> Messages.update({date: {$gt: new Date()}}, { $set: {+new Date() }}) Excellent work otherwise though. I'd love to see more open source projects released with Meteor if anything for others to learn from!
- zquestz 14y agoThanks for the suggestions, just some quick hacking over the past two nights. I will update those queries. =)
- shinta42 14y agoA quick search through github, i found there are so many open projects out already, you just have to know how to search. for example, https://github.com/Maedi/CometHop https://github.com/Maedi/CometHop https://github.com/jonathanKingston/britto https://github.com/jonathanKingston/britto https://github.com/chris-ramon/minitrello https://github.com/chris-ramon/minitrello https://github.com/maeharin/dokoiru https://github.com/maeharin/dokoiru https://github.com/tomsoderlund/MathPlay https://github.com/tomsoderlund/MathPlay https://github.com/philippkueng/rock-paper-scissors https://github.com/philippkueng/rock-paper-scissors
- azat_co 14y agoI wasn't able to see my messages. Something is broken?
- zquestz 14y agoIt auto deletes any messages that have a date greater than the server. Make sure your clock is set right. =)
- azat_co 14y agoHmm, strange. I'll check it.
- zquestz 14y agoI added some variance and pushed a hotfix. It now allows for about 10 seconds of fluxuation.
- heretohelp 14y agoOr you could just have a message pushing and time-handling facility that isn't pants-on-head retarded.
- zquestz 14y agoAgreed, timestamps are all handled by the server now. No more trusting clients. Also keep in mind this was pushed to HN about 2 hours after development started.
- heretohelp 14y agoThen stop prematurely promoting half-assed code? This is like back when Rails was new and everybody was showing off their poorly made CMS that had security issues baked in from the start.
- zquestz 14y agoYeah because it is a tech demo, not a shippable product. There is a huge difference. Sometimes people want to get their feet wet and just play with something. They offer others a chance to follow their commits, and see where the product evolves. This leads to better knowledge sharing, and finding like minded people in the community. Your nick really doesn't reflect your personality in this thread.
- user49598 14y agoheres mine from a while ago: http://instachat.meteor.com/ http://instachat.meteor.com/ source: https://github.com/spicytuna/InstaChat https://github.com/spicytuna/InstaChat you can create rooms like this: http://instachat.meteor.com/room/HackerNews http://instachat.meteor.com/room/HackerNews
- ukd1 14y agoIt worries me that security is still not a big part of this. I hope most people don't miss the fact that it's simple because it's insecure? Good luck to them solving it without ruining what's a nice idea. Sample, in your console type: Messages.remove({}) or Users.remove({})
- mibbitier 14y agofor(var i=0;i<100;i+++) {Users.insert({name: "bot00" + i, last_seen: new Date()})}; for(var i=0;i<20;i++) {Messages.insert({user: "testuser", text: "yo!", date: new Date()})}; Security stability and scalability are the hard parts.
- ukd1 14y agoOr, if you're bored and hate everyone: Meteor.setInterval(function () { Users.remove({}); Messages.remove({}); }, 500);
- zquestz 14y agoYep all are effective. Security is something meteor is currently developing and is in very early stages. To shit on them now, when they are still in active development of a product they don't even claim is production ready... is like punching babies in the face. It is completely worthless.
- mibbitier 14y agoI think the point is that what meteor already has, isn't the hard bit. Being able to send messages asynchronously has been a solved problem for a long while now. However, judging from the ridiculous amount of xhr messages flying back and forth, perhaps even that isn't done very well yet.
- drivebyacct2 14y agoYep. I think it hits a crossroads of node.js/client-side js/ease/flashiness/demo/tutorials such that it has everyone's attention.
- deleted 14y ago[deleted]
- level09 14y agois it possible to generate a non-hackable secret token on the client and validate it on the server ?
- zquestz 14y agoOther way around. Server generates the token and passes it to the client on login.
- zquestz 14y agoJust for a quick update. I have made a few commits to address the security problems people noted below. You can no longer reset any collections from the client, or spoof messages from a different user. If people still see issues in the code, you can let me know and I can patch those up too. =)