websocket emulator new function added for testing