JSON encoding, PHP sessions, beginnings of comm protocol