I solved it now by ignoring the message received callback.
I am still using the callback for connect and disconnect.
When I receive a connect I accept the socket and then create a thread for this client, which continuously waits for data, and this seems to get it all and work faster than the callback.
When disconnect is called using the callback, the receive socket already detected it is closed and the thread executes WICED_END_CURRENT_THREAD. On the place I fetch the disconnect callback I then delete the thread that I created for the client to receive data.
This approach solves the above problem for me, maybe it is useful for someone else as well.