websockets: implement plugable callbacks and subscribe