w...@dcon.at wrote:
Hi!
So it's simply not possible to retrieve the 8 bytes after the header? That's a
pitty, because that would be all I need for implementing the WebSocket
protocol and with ns_chan one could feed data to a lot of clients.
wiwo
I'm pretty sure it's not possible to implement websockets in AOLserver
without some C-level work, and if you could you wouldn't want to.
You can't, because the driver reads the entire request, including
content, before handing it off to the connection thread. And it only
reads past the headers if there is a 'Content-length' header. (You can
hook into the content-reading with a read filter, but that won't help
because with no content-length it won't ever try to read it).
You wouldn't want to, because you would attach a conn thread to a single
persistent websocket, which would severely limit how many you could
handle. Doing it as a background tcl thread would be little better,
because you'd still need a thread per connection. Handling all
websockets with a single background thread using tcl event handling
would work, if you could get read/write handles to the sockets (which
currently you can't - I think the background delivery patch only creates
a writable channel).
So what else can you do?
For starters, you could check the current state of naviserver - I'm not
up to date on what has changed there lately, but a r/w version of
'ns_conn channel' might have been implemented.
Otherwise, you need to get your hands dirty in the C code and implement
'Upgrade' handling. If you do take this approach, I'd suggest
implementing just enough logic to transfer control elsewhere - that is,
in the driver, don't try to handle websockets, rather set it up to
recognize the upgrade protocol ("Connection: upgrade" and "Upgrade:
something" headers) and call a registered procedure and forget about the
connection (leaving it to the registered proc to actually do anything
with it).
-J
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to
<lists...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
field of your email blank.