30
Updating Ember in Real-time

Updating Ember Models in Real-time with Sockets and Rx

Embed Size (px)

Citation preview

Page 1: Updating Ember Models in Real-time with Sockets and Rx

Updating Emberin Real-time

Page 2: Updating Ember Models in Real-time with Sockets and Rx
Page 3: Updating Ember Models in Real-time with Sockets and Rx

CLASS DISCUSSION UI

Page 4: Updating Ember Models in Real-time with Sockets and Rx

THE PROBLEM WITH CLASS DISCUSSION

Page 5: Updating Ember Models in Real-time with Sockets and Rx

• Everything should be real-time… eventually• Connect to a live events socket• Receive a mixed feed of all subscribed events• Manually register for chat channels• Forced disconnection every minute

Going Real-timeSERVICE CONSTRAINTS

Page 6: Updating Ember Models in Real-time with Sockets and Rx

First Attempt

Page 7: Updating Ember Models in Real-time with Sockets and Rx

• Staying connected to a unpredictable service• Updating with messages sent while disconnected• Maintaining state on live chat channels• Logic for all event types lived in one service• Slowly building an app-wide state machine

It Worked! But…KEY ISSUES

Page 8: Updating Ember Models in Real-time with Sockets and Rx

RxJSA complicated solution to a complicated problem!

Page 9: Updating Ember Models in Real-time with Sockets and Rx

RxJSA complicated solution to a complicated problem!

“[…] transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.”

🤔

Page 10: Updating Ember Models in Real-time with Sockets and Rx

It’s Not as Bad as You Think™

RxJS

Page 11: Updating Ember Models in Real-time with Sockets and Rx

• Observers• Events• Bindings• Array functions• Promises

RxJSIT’S MOSTLY STUFF YOU ALREADY KNOW

Page 12: Updating Ember Models in Real-time with Sockets and Rx

Staying Connected to a Unpredictable Service

Page 13: Updating Ember Models in Real-time with Sockets and Rx

STAYING CONNECTED TO A UNPREDICTABLE SERVICE

Page 14: Updating Ember Models in Real-time with Sockets and Rx

STAYING CONNECTED TO A UNPREDICTABLE SERVICE WITH RX

Page 15: Updating Ember Models in Real-time with Sockets and Rx

STAYING CONNECTED TO A UNPREDICTABLE SERVICE WITH RX

Page 16: Updating Ember Models in Real-time with Sockets and Rx

STAYING CONNECTED TO A UNPREDICTABLE SERVICE WITH RX

Page 17: Updating Ember Models in Real-time with Sockets and Rx

STAYING CONNECTED TO A UNPREDICTABLE SERVICE WITH RX

Page 18: Updating Ember Models in Real-time with Sockets and Rx

STAYING CONNECTED TO A UNPREDICTABLE SERVICE WITH RX

http://rxmarbles.com/#zip

Page 19: Updating Ember Models in Real-time with Sockets and Rx

STAYING CONNECTED TO A UNPREDICTABLE SERVICE WITH RX

Page 20: Updating Ember Models in Real-time with Sockets and Rx

STAYING CONNECTED TO A UNPREDICTABLE SERVICE WITH RX

Page 21: Updating Ember Models in Real-time with Sockets and Rx

ANYONE FEELING LIKE THIS?

Page 22: Updating Ember Models in Real-time with Sockets and Rx

Me too! Let’s keep going!

Page 23: Updating Ember Models in Real-time with Sockets and Rx

Actually Updating a Model

Page 24: Updating Ember Models in Real-time with Sockets and Rx

ACTUALLY UPDATING A MODEL

Page 25: Updating Ember Models in Real-time with Sockets and Rx

ACTUALLY UPDATING A MODEL

Page 26: Updating Ember Models in Real-time with Sockets and Rx
Page 27: Updating Ember Models in Real-time with Sockets and Rx
Page 28: Updating Ember Models in Real-time with Sockets and Rx

ACTUALLY UPDATING A MODEL

Page 29: Updating Ember Models in Real-time with Sockets and Rx

ACTUALLY UPDATING A MODEL

Page 30: Updating Ember Models in Real-time with Sockets and Rx

MAINTAINING STATE ON LIVE CHAT CHANNELS