WebSocketReceiveMessage gives Connection Timeout

I am able to establish a connection with WebSocketConnectSync() and successfully sending messages using WebSocketSendTextMessage().

While receiving messages from the server I am getting a connection timeout error. Below the error log.

Warning VirtUser-Profile1_1 localhost 26 00:00:01 WebSocketConnectSync WebEngine: 13 - The connection closed gentle or timed out, but earlier than expected.
Error VirtUser-Profile1_1 localhost 35 00:00:01 WebSocketReceiveMessage WebEngine: 818 - WebSocket closed during receiving a WebSocket message.

Please help/suggest.