Api code to handle bidirectional sync b/w tabs and server