Meteor

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Meteor - Presentation Transcript

    1. Meteor server and
      • Quick recap of Comet
      • Why it’s good
      • Demo of Meteor
      • Integrating with PHP
      • Q&A
      Characters reproduced (badly) from some very nifty BUPA adverts. (www.bupaworld.com)
    2. Typically information on the web is requested by the client Sometimes, this model is very inefficient...
    3. Are we nearly there yet? No.
    4. Problem: the client doesn’t know when to ask So it keeps asking again and again...
    5. Are we nearly there yet? Still no.
    6. This kind of interaction is Short polling Same query repeated until desired response is received. Server gets pissed off rapidly.
    7. Other problems with short polling
      • Repetitive database queries
        • Unnecessary load
      • Bandwidth use
        • Negative responses
        • Cookies!
      • Delay before client sees data
      • Unpredictable data delivery times
    8. These problems arise whenever something happens (an event) that affects the client , but which is not triggered by them.
    9. Sources of relevant events
      • Other clients/users
      • External events
      • Status changes
      • Progress feedback
    10. Users interacting with other users often see a site as a representation of all those other people. So, they need to know when their context changes.
    11. Meteor is a comet server, that keeps each user’s context fresh with new information delivered as it becomes relevant to that user.
    12. Demo Here’s one I prepared earlier* *Apologies for Blue Peter reference
    13. It’s the Meteor-powered Real Time Teenage Angst Monitor ?
    14.  
    15. Data is sent when it’s ready on a persistent, pre-established connection, enabling: Streaming
    16. How to use this in PHP
      • Event controllers
      • Channels
      • Subscribers
      Components of a Meteor app:
      • Create messages
      • Inject messages into Meteor on a channel
      • Can read stats back from Meteor
      Event controllers
    17. Sample event controller in PHP // Create an array of words $sayings = array("the", "quick", "brown", "fox", "jumps", "over", "lazy", "dogs"); // Open a controller channel to Meteor server $op = fsockopen("127.0.0.1", 4671, $errno, $errstr, 5); // Write a random word $out = "ADDMESSAGE demo ".$sayings[array_rand($sayings)]." "; fwrite($op, $out); // Read response $buf = fread($op, 4096);
      • Listen on one or more channels
      • Meteor Javascript library handles comms
      • Hook in your own callback functions
      Subscriber clients
    18. Sample subscriber client JS <script type=&quot;text/javascript&quot; src=&quot;http://data.example.com/meteor.js&quot;></script> <script type=&quot;text/javascript&quot;> Meteor.hostid = 1; Meteor.host = &quot;data.&quot;+location.hostname; Meteor.registerEventCallback(&quot;process&quot;, test); Meteor.joinChannel(&quot;demo&quot;, 5); Meteor.mode = 'stream'; Meteor.connect(); function test(data) { window.status = data }; </script>
      • Apache: example.com
      • Meteor: data.example.com
      • Different hostnames
      • Can be same machine via port redirection or IP-binding
      Separating servers
      • An effective Publish-Subscribe system
      • A great way of broadcasting updates to groups of subscribers
      So in summary, Meteor is:
      • A way of pushing data to individually addressable clients
      Meteor is not:
    19. Real world users of Meteor
    20. Questions?

    + triblondontriblondon, 3 years ago

    custom

    1367 views, 0 favs, 1 embeds more stats

    A talk at PHP London on the subject of Meteor serve more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1367
      • 1366 on SlideShare
      • 1 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds
    • 1 views on http://localhost

    more

    All embeds
    • 1 views on http://localhost

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories