Use JSON for commands on socket

Also, use "id" instead of "tag", and add "msg" as a possible command for setting the message to send.