A few weeks ago I watched a demo video of a framework that could synchronize data between clients. It showed 2 browsers that displayed a list of data. When a new item was inserted into one, it would also appear on the second.
I forgot to bookmark this website. I don't quite know the language it was written in, but I suspect node. Now I would like to investigate this mechanism of synchronizing data, but can't find this framework again.
Can anyone recall such a framework or comparable "technology"?
You probably saw this screencast of Meteor:
http://www.meteor.com/screencast
Just a wild guess :)
Related
I'm coding a basic game in HTML/javascript/CSS and I'm just after some advice on best practice/best way to do it.
I only have a basic knowledge of javascript but it seems easy enough and there's nothing too fancy required in my game.
The game will be relatively simple in that it's mainly menu/screen based; there will be a main menu which the user navigates from, which will open the required screen for them to make in game purchases etc, before returning to the main menu screen.
What I'm trying to work out is whether I should do it as just one page, that dynamically changes as the user makes their choices, or several pages for each of the menu items. The second sounds much 'cleaner' in terms of code and layout, but then I have to pass variables across to each page. Some of this information needs to be secure, so I'm thinking of using HTML5's localStorage or sessionStorage. It seems to work well in Chrome but IE8 doesn't seem to like it during my offline testing, apparently you need to have the file uploaded as it's 'domain' based? I thought the whole 'local' meant it could be done locally!
What I also need to consider is that in the future I'd like to convert this to a Facebook or even mobile app. I believe there are some 'wrappers' available and that you can port it across... is the fact that I'm planning on using multiple pages/localStorage going to affect future portability? Is there another way I should be doing this?
Thanks
I have create a few HTML5 Javascript games, I for one did not purchase any books as you can usually find some good stuff out there on the web, so just do some google searchs for HTML5 canvas game or Javascript Html Game.
The best thing to try and keep in mind is OOP (Object-oriented programming), this really helped me out create my simple games as it just keeps a nice pattern.
But basically what I did was just dive straight in and just code. A good editor is Sublime.
Sorry I couldn't off been much help however, if you take a look at a game I created and view the source files, you may get a good understanding of how to create a game :)
http://canvascode.co.uk/Projects/SpaceDestroyer/spacedestroyer.html
Also you could always pick up Unity which is portable for nearly every system there is :)
OK, so I have a basic knowledge of PHP, and I'm fairly advanced in CSS/HTML/JavaScript.
I'm trying to set up a page that when an Admin types a message ("Hello, world!"), all the clients automatically update and display this new message in an H1 element.
How do I get the admin page to "talk" to the client page?
I can use PHP, JavaScript and HTML for this, but I'd rather stick to just HTML and JavaScript as my knowledge in PHP is not the best.
Is this possible, and if so, does anyone know how to do this?
It means a lot to me that you guys are willing to help, so thanks!
We can call this real time notifications too.
I won't teach how to do, but will talk about some solutions and ways to do it.
The Node.JS
The first solution is use a websocket. The PHP isn't the best programming language to work with websockets. Node.JS is a great solution. You can use http://socket.io/.
With Socket.IO you can work with websockets easily. Doing things like that in some minutes.
I recommend you read the article below:
http://www.phpbuilder.com/articles/application-architecture/optimization/creating-real-time-applications-with-php-and-websockets.html
Paid solutions
A great paid solution is the https://pusher.com/. When you work with notifications, the Pusher won't cost cheap, because you can have thousand of visitors in your website. But when you work with a chat, the Pusher is good.
(the Pusher price is based on the connected users of your website, and not the notifications that were sent, that is a big problem when we work with notifications, for example, a small volume of messages, but so many users receiving)
Have many other solutions, but i think Pusher is one of the bests.
PHP Solutions
Elephant.io: http://elephant.io/, you'll make a integration between Node.JS, PHP and Socket.io.
Ratchet: http://socketo.me/, i recommend you read the documentation: http://socketo.me/docs/, really great way to start.
Have many solutions too, but know this 2 above first, they're great.
The solution with the "pure power" of the olders
A little bit unnecessary with the new technologies, but works.
Make a application that send messages and save into the database, after that, basically make a ajax polling updating the messages every 5 seconds, for example, and showing to the user when loads.
Works well, but will consume much of your server, and will update even if the application has no new messages to show. (You can work better with it and avoid this problem).
Hello Stack Overflow community,
I'm a rather novice coder, but I have a project I've been devising that looks more and more complicated every day, and I don't know where to start.
With inspiration taken from Synchtube & Phonoblaster, I'm looking to create something for my website that will allow visitors to watch YouTube videos and playlists that I have curated, together in real-time, in-sync.
Because I want to be able to put this in the context of my own website, I can't use the services listed above that already do this - so I wanted to figure out how to roll my own.
Some things have been written about this topic on Stack Overflow, and other blogs:
HERE
and HERE.
Because I still consider myself a novice programmer, and a lot of the information I've found on Google and Stack tends to be more than 1 or 2 years old, I'm still unsure where to begin or if this information is outdated. Specifically, what languages and tools I should be learning.
From what I've gathered so far, things like Javascript, Node.JS, and the YouTube API would form the crux of it. I've not used any of these before, but would be interested to see whether other experienced coders would have their own suggestions or ideas they could point me towards.
I appreciate you taking time out to read this post!
Hope to hear from some of you soon :)
Many thanks.
It partially sounds like you need a live stream from Youtube. You can find more info here. https://support.google.com/youtube/bin/answer.py?hl=en&answer=2474026
If you can get that going, then syncing play between any number of users is as simple as embedding a regular youtube embed of your stream in a browser.
Looking past that, if you wanted to sync video playback amongst any number of users, the first big problem is learning how to set time on a video. Luckily, that's easy with the hashbang #t=seconds.
Eg: http://www.youtube.com/watch?v=m38RdUGqBPM&feature=g-high-rec#t=619s will start this HuskyStarcraft video at 619 seconds into the video.
The next step is to have some backend server that keeps track of what the current time is. Node.js with Socket.io is incredibly easy to get setup. Socket.io is a wonderful library that gracefully handles concurrency connections from web sockets all through long polling and more and works well even on very old browsers. Note that websockets aren't even required, but will be the most modern and full-proof method for you. Otherwise its hacks and stuff.
One way this could work would be as follows.
User1 visits your site and starts playing the video first. A script on your page sends an XHR request to your server that says, "video started at time X". X then gets stored as the start time.
At this point, you could go 2 routes. You can have a client-side script using the Youtube API to poll the video and get its current status every second. If the status or time changes, send another request back to the server to update the state.
Another simple route would be to have the page load for User2+, then send an XHR request asking for the video play time. The server sends back the difference between the start time from User1, then the client script sets the 't' hashbang on the youtube player for User2+. This lets you sync start times, but if any users pause or rewind the video, those states dont get updated. A subsequent page refresh might do that though.
The entire application complexity depends on exactly what requirements you want to have. If its just synchronized start times, then route #2 should work well enough. Doesn't require sockets and is easy to do with jQuery or just straight javascript.
If you need a really synchronized experience where any user can start/stop/pause/fast forward/rewind the video, then you're looking at either using an established library solution or writing your own.
Sorry this answer is kind of open ended, but so was your question. =)
I've implemented a web based instant messaging / chat feature using http binding and ejabberd. For the lazy here's the short version of my question:
How would you go about implementing a web based XMPP chat client which could be displayed in multiple browser windows simultaneously, each displaying an identical view of the open chats?
More detailed ramblings for those who care:
One potential solution would be to just let every tab manage it's own connection. XMPP has decent enough support for multiple clients so let it do the routing. I have at least 2 issues with this solution. 1 is the obvious increase in bandwidth consumption this would cause. 2 is the current lack of support for multiple clients with the same JID to connect to MUC rooms in ejabberd. This will apparently be implemented for 3.1 but it's a major issue for me as it stands.
Initially I wondered if there might be some flash magic involved but it seems the swf on the page is only used to play the notification sound effects. You can confirm this by using firebug or similar to delete the embed tag. The chat feature still works.
This basically leaves me with cookies as the only way to share between the tabs. In this scenario a master tab would dump all messages to cookies which could be polled from other tabs. This seems quite ridiculous to me as the poll frequency would have to be exceptionally high to avoid any latency. What would happen when the 'master' window was closed?
I've seen this done by more than one site and normally when I look at problems like these I can at least understand at least vaguely how I'd go about it but I don't mind admitting this one has got me stumped.
So I've poked around in facebook chat a little more and it seems that they are just letting every tab manage it's own connection. Ejabberd puts several hurdles in my way to achieve this with MUC rooms so I guess that's why I was inclined to discount this solution initially. I think private messaging only should be more straightforward for anyone else interested.
The issue with multiple MUC instances is https://support.process-one.net/browse/EJAB-305
I guess I'l have to make a case for patching ejabberd. If anyone has any other observations I'd love to hear them.
I sign up Spring courses tomorrow morning (transferring in to the Computer Science program). Since I'm a transfer student, I get the last pick of leftover classes not already taken. Emphasis on 'last pick' and 'leftover'. It's highly probable that whatever classes I intend on picking tomorrow, I might not even get because other students will be vying for those same classes. Add on top of this, even with scheduling, an extremely sluggish server when it gets hit with a big load.
So, when I register next semester (or even register for different classes for Spring if others drop 'em) I'd like to have a script or code ready to go so I could just automate my inputs without filling out web forms and hoping the server parses them correctly. (By inputs, I'm being general -- from automatically filling in form fields to SQL inputs). Obviously, this might not work. But, what I'm looking for is a kind of keylogger for a web browser, which would download all web pages visited, any javascript executed, forms filled out, anything and everything. This way, I could analyze the data later, and at my leisure, to see if I could do this in a better way.
Any suggestions on what could do this? (I'm thinking maybe some testing software?). Thanks in advance.
Selenium can automate most browser based tasks. http://selenium.seleniumhq.org/
The Grinder comes with a local proxy that can record traffic and is scriptable with Python. http://grinder.sourceforge.net/
I would highly suggest you check out your university's acceptable use policy, at mine, such a thing would be considered a serious infraction and possibly get you kicked out.
CoScripter does pretty much exactly what you need.