[racket-dev] Synchronizing on WebSocket connections

From: Tom McNulty (tom at cetiforge.com)
Date: Sat Dec 24 14:46:36 EST 2011

I recently had a need to simultaneously sync on both thread-receive-evt's and incoming data from a web socket connection. To accomplish the latter, a minor change is required to allow ws-conn to act as an event.  Perhaps it can be useful to someone else?

--- a/collects/net/websocket/conn.rkt
+++ b/collects/net/websocket/conn.rkt
@@ -3,7 +3,9 @@
 
 (define framing-mode (make-parameter 'old))
 
-(struct ws-conn ([closed? #:mutable] line headers ip op))
+(struct ws-conn ([closed? #:mutable] line headers ip op)
+         #:property prop:evt (struct-field-index ip))
+







 


Posted on the dev mailing list.