Combining ideas from both Redux and CRDT, Logux is a new tool which replaces AJAX with real-time data in applications, synchronising action logs between the client and server while also providing an offline mode. This approach could significantly simplify application code and bring plug&play support for live updates and offline editing.
34. Solution
“Bad programmers worry about the code.
Good programmers worry about
data structures”
— Linus Torvalds
Source: https://lwn.net/Articles/193245/
34
63. Server sends current time
[
"connected",
[0, 0], // Protocol version
"server:h4vjdl", // Server unique ID
[
1475316481050, // "connect" message was received
1475316482879 // "connected" message was sent
]
]
63
75. Other problems of distributed systems
Problems
Firewalls and WS
Log cleaning
Scaling
Outdated clients
Deduplication
Solutions
Force WSS
Action’s reasons of life
Peer-to-peer protocol
Subprotocol verification
Action ID
75
97. Server: use any DB or send any requests
process(action, meta) {
return db.user.id(action.user).then(u => {
if (isFirstOlder(u.lastChange, meta)) {
return u.changeName(action.name)
}
})
}
97
98. Server: send actions to client at any time
app.log.add({
type: 'CHANGE_NAME',
name: 'Looser',
user: user.id
})
98