Allow multithread write#81
Conversation
|
Ah thank you for bringing this up yourself! I recently wrote a short tutorial about websocket use in CL, and I had wanted to used Clack + Woo + websocket-driver , but hit this issue, and so switched to Hunchentoot+Hunchensocket instead. |
|
CLOG also needs this. I hope my mentioning can help Woo get more momentum from the whole Common Lisp community. Thanks! |
|
Oh, thanks! |
|
Was this ever resolved? |
|
It does not seem resolved as of today, at least not in the Quicklisp distribution. This minimalist connection handler works perfectly: (defun handle-connection-nt (env)
"When a new connection is requested for a client, create or reuse an existing channel"
(let* ((ws (wsd:make-server env)))
(wsd:on :message ws
(lambda (msg)
(wsd:send-text ws (reverse msg))))
(lambda (responder)
(declare (ignore responder))
(wsd:start-connection ws))))However, if I put the message handler in a thread, then woo closes the connection before the answer is sent. Hutchentoot works fine, so I switched to it (momentarily I hope) (defun handle-connection (env)
(let* ((ws (wsd:make-server env)))
(self *ws* ws)
(wsd:on :message ws
(lambda (msg)
(bt2:make-thread #'(lambda () (wsd:send-text ws (reverse msg))))))
(lambda (responder)
(declare (ignore responder))
(wsd:start-connection ws))))When I run this with (wsd:ready-state *ws*)
:CLOSEDOf course, my application uses threads for more serious reasons than raising issues with woo. But at least, this code may be used as a test for when the bug will be solved (hopefully soon ?). |
No description provided.