Flushing websockets?


I am using websockets to communicate between a prolog server and a non prolog client. Sometimes the server sends data over to the client using ws_send. It all happens locally on one machine.

Sometimes, it takes quite a bit of time for a message sent to be received by the client, and i am wondering what that delay is ā€“ could it be that after ws_send there is some message buffering going on and to send messages immediately, there is a need for flush, somehow?

any thoughts are much appreciated,


ws_send/2 always flushes the output. So, there is either a bug in ws_send/2 or somewhere else in your setup. Iā€™d try system call tracing with timing (on Linux using strace, but most systems have something similar) to get detailed timing on the system calls in both sender and receiver and see what is happening.