generalized writing
thread-based wsclient