Fixed looping.
Implemented json ws