• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Djangocon Europe 2012 - Sync-Models
 

Djangocon Europe 2012 - Sync-Models

on

  • 422 views

Those are my slides from the DjangoCon Europe 2012 lightning talk: Sync-Models - Synchronizing Object Graphs in Realtime

Those are my slides from the DjangoCon Europe 2012 lightning talk: Sync-Models - Synchronizing Object Graphs in Realtime

Statistics

Views

Total Views
422
Views on SlideShare
398
Embed Views
24

Actions

Likes
0
Downloads
1
Comments
0

3 Embeds 24

http://eventifier.co 19
http://eventifier.com 3
http://www.eventifier.co 2

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Djangocon Europe 2012 - Sync-Models Djangocon Europe 2012 - Sync-Models Presentation Transcript

    • Sync-Models Synchronizing Object Graphs in RealtimeWednesday, 6. June 2012 [W]
    • Basic idea Server Synchronize object graphs Push changes via long-polling (future plan: WebSockets, SSE) Push!!!11one Every object gets an unique id to identify the object Once part of the graph - push updates to the client automatically ClientWednesday, 6. June 2012 [W]
    • Ingredients Django (only some nifty bits of it) gevent “Simple JavaScript Inheritance” by John Resig KnockoutJS kodex.sync (to be released under F/OSS license) Help wanted. Meet me at the sprint on thursday.Wednesday, 6. June 2012 [W]
    • Architecture Server Call Long polling SSE* WebSocket Client *Server-sent eventsWednesday, 6. June 2012 [W]
    • Server side from kodex.sync import models class BulletinBoard(models.RootModel): messages = models.ReferenceListField() class Message(models.Model): user = models.ReferenceField() text = models.StringField()Wednesday, 6. June 2012 [W]
    • Server side from kodex.sync import server class Server(server.SyncServer): def __init__(self): self.root = BulletinBoard() def post(message): self.root.messages.append(message)Wednesday, 6. June 2012 [W]
    • Client side <div id=”bb”> <ul class=”messages” data-bind=” foreach: root.messages”> <li> <span class=”user” data-bind=” text: user”></span>: <span class=”text” data-bind=” text: user”></span> </li> </ul> </div>Wednesday, 6. June 2012 [W]
    • Client side bb.Client = kodex.sync.Client.extend({ post: function(text) { this.request(‘post’, { text: text }) } }) var client = new bb.Client(); $(‘#bb’).koApplyBindings(client);Wednesday, 6. June 2012 [W]
    • Live DemoWednesday, 6. June 2012 [W]
    • { “0”: { Protocol “class”: “bb.BulletinBoard”, (Snapshot) “messages*”: [1] }, “1”: { “class”: “bb.Message”, “user*”: 2, “text”: “What rocks?” }, “2”: { “class”: “auth.User”, “username”: “bikeshedder” } }Wednesday, 6. June 2012 [W]
    • { “0”: { Protocol “messages*”: [2, 4] (Updates) }, “4”: { “class”: “bb.Message”, “user*”: 5, “text”: “Django and DjangoCon Europe 2012” }, “5”: { “class”: “auth.User”, “username”: “solid” } }Wednesday, 6. June 2012 [W]
    • Protocol (Delete) { Not implemented, yet. “0”: { “messages*”: [4] }, “1”: null, “2”: null }Wednesday, 6. June 2012 [W]
    • http://bikeshedder.com/ KODEX beta sign-up: http://kodexgame.com/beta/Wednesday, 6. June 2012 [W]