Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.34 KB

SYNCHRONOUS_EDITING.md

File metadata and controls

30 lines (21 loc) · 1.34 KB

The new synchronous editing feature

With the introduction of ActionCable to our system, it has been possible to do perform real-time tasks quite easily. We have used rail's default action cable to make a concurrent_editing_channel.rb in the app/channels folder, to handle all the incoming requests and consists of all the business logic as well. At the frontend we have, app/javascripts/channels/concurrent_editing.js which handles the logic at the browser or the frontend.

Flow of the feature:

  1. When the map is updated, the speak method of concurrent_editing.js is called which requests the sync method of concurrent_editing_channel.rb to broadcast the updated data to the connected users.

  2. The broadcasted data is finally caught by the received function of app/javascripts/channels/concurrent_editing.js

  3. Finally the received function calls the synchronizeData function to update all the fresh data on the map.

Testing:

  1. The action-cable-testing gem is used for the feature's testing. It has some really cool testing functionality which was required for our use case.

  2. Currently we have separate tests written for connection related features and channel specific features. The relevant files are test/channels/concurrent_editing_channel_test.rb and test/channels/connection_test.rb