Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 8d6e177fb8e53a0edc7364f6d5cc7e42b9a59072 @e-user committed Aug 23, 2011
Showing with 1,120 additions and 0 deletions.
  1. +661 −0 COPYING
  2. +90 −0 README
  3. +1 −0 README.md
  4. +35 −0 hunchensocket.asd
  5. +37 −0 server/package.lisp
  6. +296 −0 server/websocket.lisp
Oops, something went wrong.
@@ -0,0 +1,90 @@
+Hunchensocket - WebSockets for Hunchentoot
+==========================================
+Hunchensocket is a Common Lisp implementation of [WebSocket]s realized
+as an extension to (Edi Weitz')[edi] excellent [Hunchentoot] web server.
+
+As [WebSocket]s are still in draft state and security concerns have been
+(raised)[http://www.ietf.org/mail-archive/web/hybi/current/msg04744.html] against older
+(but supported) draft versions of the protocol implemented in a number of
+browsers, it should not be used productively (yet), unless of course you know
+what you're doing.
+
+
+Installation
+------------
+Hunchensocket is supported by and available through [asdf-install] and
+(soon) [Quicklisp].
+
+
+Support
+-------
+Currently, only (draft-ietf-hybi-thewebsocketprotocol-00)[draft-hybi-00] aka
+draft-hixie-thewebsocketprotocol-76 as implemented in [Chromium] versions 6 to
+13 and [Firefox] 4.0 to 5.0 (disabled, must be enabled explicitly) are available
+but newer drafts and the future standard are to come as new web browser versions
+supporting them emerge. For a more complete matrix including proprietary
+browsers, please consider the WebSocket
+(Wikipedia article)[http://en.wikipedia.org/wiki/WebSocket#Browser_support].
+
+
+Usage
+-----
+Hunchensocket is meant to be used as a Hunchentoot extension. In order to be
+able to establish and send and receive on WebSockets, Follow the regular
+Hunchentoot (documentation)[http://www.weitz.de/hunchentoot/#start] but exchange
+the regular `HUNCHENTOOT:ACCEPTOR` and `HUNCHENTOOT:SSL-ACCEPTOR` with
+`HUNCHENSOCKET:WEBSOCKET-ACCEPTOR` and `HUNCHENSOCKET:WEBSOCKET-SSL-ACCEPTOR`,
+respectively.
+
+In order to make use of WebSocket connections, one must define WebSocket
+handlers that decide whether to accept a WebSocket request and, if they do,
+return a cascading closure of function as follows:
+```λ request -> λ stream mutex -> λ message```
+Or, in other words, a (dispatcher) function that takes a Hunchentoot request
+object and, if it accepts the request, returns a (handshake handler) function
+which is not obliged to perform additional obligatory steps but can be used to
+perform initial set-up stuff but finally has to evaluate to a final (message
+handler) function that will be called upon socket input and has access to the
+both lexically enclosed and dynamically available websocket stream and mutex
+objects in order to send data through the socket.
+
+Unless you have very special plans for using WebSockets, esp. in case all you
+want is to exploit their possibilities for your web project, you are adviced to
+use [hunchen.io] which handles the tedious parts for you and can be used
+together with the [socket.io] client-side JavaScript libraries.
+
+
+Links and References
+--------------------
+Homepage: <http://www.cliki.net/hunchensocket>
+Hacking: <http://github.com/e-user/hunchensocket>
+
+[WebSocket]: http://en.wikipedia.org/wiki/WebSocket
+[edi]: http://weitz.de/
+[Hunchentoot]: http://weitz.de/hunchentoot/
+[asdf-install]: http://www.cliki.net/ASDF-Install
+[Quicklisp]: http://www.quicklisp.org/
+[draft-hybi-00]: http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-00
+[Chromium]: http://www.chromium.org/Home
+[Firefox]: http://www.mozilla.com/en-US/firefox/new/
+[hunchen.io]: TBD
+[socket.io]: http://socket.io/
+
+
+
+Copyright
+---------
+Copyright (C) 2011 Alexander Kahl <e-user@fsfe.org>
+This file is part of Hunchensocket.
+Hunchensocket is free software; you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+Hunchensocket is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -0,0 +1,35 @@
+;;;; Hunchensocket - engine.asd Hunchensocket ASDF definition file
+;;;; Copyright (C) 2011 Alexander Kahl <e-user@fsfe.org>
+;;;; This file is part of Hunchensocket.
+;;;; Hunchensocket is free software; you can redistribute it and/or modify it
+;;;; under the terms of the GNU Affero General Public License as
+;;;; published by the Free Software Foundation; either version 3 of the
+;;;; License, or (at your option) any later version.
+;;;;
+;;;; Hunchensocket is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;;; GNU General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU General Public License
+;;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(in-package :cl-user)
+
+(defpackage :hunchensocket-system
+ (:use :cl :asdf))
+
+(in-package :hunchensocket-system)
+
+(asdf:defsystem :hunchensocket
+ :description "WebSockets for Hunchentoot"
+ :author "Alexander Kahl <e-user@fsfe.org>"
+ :license "AGPLv3+"
+ :depends-on (:alexandria :ironclad :flexi-streams :chunga :trivial-utf-8
+ :trivial-backtrace :bordeaux-threads)
+ :components
+ ((:module "server"
+ :serial t
+ :components
+ ((:file "package")
+ (:file "websocket")))))
@@ -0,0 +1,37 @@
+;;;; Hunchensocket - package.lisp
+;;;; Copyright (C) 2011 Alexander Kahl <e-user@fsfe.org>
+;;;; This file is part of Hunchensocket.
+;;;; Hunchensocket is free software; you can redistribute it and/or modify it
+;;;; under the terms of the GNU Affero General Public License as
+;;;; published by the Free Software Foundation; either version 3 of the
+;;;; License, or (at your option) any later version.
+;;;;
+;;;; Hunchensocket is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;;; GNU General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU General Public License
+;;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+; FIXME upstream
+(in-package :hunchentoot)
+(export (list 'content-stream 'set-timeouts 'acceptor-listen-socket))
+
+(in-package :hunchensocket-system)
+
+(defpackage :hunchensocket
+ (:use :cl :alexandria :hunchentoot :cl-ppcre :alexandria
+ :flexi-streams :trivial-utf-8 :bordeaux-threads)
+ (:import-from :ironclad :digest-sequence)
+ (:import-from :chunga :read-char*)
+ (:import-from :trivial-backtrace :print-backtrace)
+ (:export :websocket-acceptor
+ :websocket-ssl-acceptor
+ :websocket-handle-handshake
+ :websocket-send-message
+ :websocket-send-term
+ :default-websocket-handler
+ :*websocket-handlers*
+ :*websocket-stream*
+ :*websocket-stream-mutex*))
Oops, something went wrong.

0 comments on commit 8d6e177

Please sign in to comment.