websockets implementation and tests