add client side synchronized write function, tested demo on localhost