03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Real Time Chat 189<br />

debugging commands through it.<br />

This allows us to see both the server-side of things, as well as the client-side…<br />

Wiring Up The Interface<br />

Getting our interface talking to our socket server is relatively straightforward. We begin by disabling<br />

our fixture data and modifying our model slightly:<br />

1 App.Message = DS.Model.extend({<br />

2 "user_id" : DS.attr("integer"),<br />

3 "user_name" : DS.attr("string"),<br />

4 "user_id_class" : DS.attr("string"),<br />

5 "message" : DS.attr("string")<br />

6 });<br />

7<br />

8 App.ApplicationAdapter = DS.FixtureAdapter.extend();<br />

9<br />

10 App.Message.FIXTURES = [<br />

11 // {<br />

12 // "id" : 1,<br />

13 // "user" : "Chris",<br />

14 // "text" : "Hello World."<br />

15 // },<br />

16 // {<br />

17 // "id" : 2,<br />

18 // "user" : "Wayne",<br />

19 // "text" : "Don't dig it, man."<br />

20 // },<br />

21 // {<br />

22 // "id" : 3,<br />

23 // "user" : "Chris",<br />

24 // "text" : "Meh."<br />

25 // }<br />

26 ];<br />

.<br />

This was extracted from public/js/shared.js.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!