chickadee » websockets » with-concurrent-websocket

with-concurrent-websocket #!optional procedureprocedure

This will, like with-websocket, handle setting up and closing a websocket connection. procedure is a thunk to be executed after the websocket has been successfully setup.

with-concurrent-websocket adds to with-websocket by running a thread in the background to read in messages as they arrive and spins off a new thread to process each message. Messages can arrive out-of-order, especially if there are a mix of very large and very small messages. with-concurrent-websocket can be very useful if very large messages are expected since they can take a long time to unmask and UTF8 validate.

Sending messages are still done in a blocking fashion but sending is relatively fast and will likely not be a problem. This could change in the future though so don't rely on it.