add rest api and socket
implement testing