simplified api and added web sockets support