socket communication with json