websocket API, optimize imports