{"id":18511918,"url":"https://github.com/joaotavora/hunchensocket","last_synced_at":"2026-01-28T12:35:29.215Z","repository":{"id":16504562,"uuid":"19257475","full_name":"joaotavora/hunchensocket","owner":"joaotavora","description":"RFC6455 compliant WebSockets for Common Lisp","archived":false,"fork":false,"pushed_at":"2024-10-17T18:11:50.000Z","size":123,"stargazers_count":118,"open_issues_count":13,"forks_count":22,"subscribers_count":9,"default_branch":"master","last_synced_at":"2026-01-15T00:44:46.157Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joaotavora.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-28T23:32:06.000Z","updated_at":"2025-10-15T20:06:36.000Z","dependencies_parsed_at":"2024-11-06T15:51:28.944Z","dependency_job_id":null,"html_url":"https://github.com/joaotavora/hunchensocket","commit_stats":null,"previous_names":["capitaomorte/hunchensocket"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/joaotavora/hunchensocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joaotavora%2Fhunchensocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joaotavora%2Fhunchensocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joaotavora%2Fhunchensocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joaotavora%2Fhunchensocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joaotavora","download_url":"https://codeload.github.com/joaotavora/hunchensocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joaotavora%2Fhunchensocket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28845280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T10:53:21.605Z","status":"ssl_error","status_checked_at":"2026-01-28T10:53:20.789Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T15:30:41.125Z","updated_at":"2026-01-28T12:35:29.198Z","avatar_url":"https://github.com/joaotavora.png","language":"Common Lisp","funding_links":[],"categories":["Interfaces to other package managers"],"sub_categories":["Hosting platforms"],"readme":"![build and test](https://github.com/joaotavora/hunchensocket/actions/workflows/build-and-test.yml/badge.svg)\n\nHunchensocket - WebSockets for Hunchentoot\n==========================================\n\nHunchensocket is a Common Lisp implementation of [WebSocket]s realized\nas an extension to [Edi Weitz'] [edi] excellent [Hunchentoot] web\nserver. Hunchensocket implements a compliant [RFC6455][RFC6455] server. \n\nNote that Alexander Kahl, the original author, has desactivated his \n[old version][kahl] that only supports the drafts of the protocol.\n\nInstallation\n------------\n\nHunchensocket is in [Quicklisp][Quicklisp], so if you have that\nsetup just do `(ql:quickload :hunchensocket)`.\n\nQuicklisp is also good to use the trunk alongside with other \ndependencies, perhaps to test a new feature or a bugfix:\n\n```\n$ cd ~/Source/Lisp/\n$ git clone https://github.com/joaotavora/hunchensocket.git\n```\n\n```lisp\n(push \"~/Source/Lisp\" ql:*local-project-directories*)\n(ql:quickload :hunchensocket) ;; use local hunchensocket and pull\n                              ;; dependencies from quicklisp\n```\n\nA chat server in 30 lines\n-------------------------\n\nFirst define classes for rooms and users. Make these subclasses of\n`websocket-resource` and `websocket-client`.\n\n```lisp\n(defpackage :my-chat (:use :cl))\n(in-package :my-chat)\n\n(defclass chat-room (hunchensocket:websocket-resource)\n  ((name :initarg :name :initform (error \"Name this room!\") :reader name))\n  (:default-initargs :client-class 'user))\n\n(defclass user (hunchensocket:websocket-client)\n  ((name :initarg :user-agent :reader name :initform (error \"Name this user!\"))))\n```\n\nDefine a list of rooms. Notice that\n`hunchensocket:*websocket-dispatch-table*` works just like\n`hunchentoot:*dispatch-table*`, but for websocket specific resources.\n\n```lisp\n(defvar *chat-rooms* (list (make-instance 'chat-room :name \"/bongo\")\n                           (make-instance 'chat-room :name \"/fury\")))\n\n(defun find-room (request)\n  (find (hunchentoot:script-name request) *chat-rooms* :test #'string= :key #'name))\n\n(pushnew 'find-room hunchensocket:*websocket-dispatch-table*)\n```\n\nOK, now a helper function and the dynamics of a chat room.\n\n```lisp\n(defun broadcast (room message \u0026rest args)\n  (loop for peer in (hunchensocket:clients room)\n        do (hunchensocket:send-text-message peer (apply #'format nil message args))))\n\n(defmethod hunchensocket:client-connected ((room chat-room) user)\n  (broadcast room \"~a has joined ~a\" (name user) (name room)))\n\n(defmethod hunchensocket:client-disconnected ((room chat-room) user)\n  (broadcast room \"~a has left ~a\" (name user) (name room)))\n\n(defmethod hunchensocket:text-message-received ((room chat-room) user message)\n  (broadcast room \"~a says ~a\" (name user) message))  \n```\n\nFinally, start the server. `hunchensocket:websocket-acceptor` works\njust like `hunchentoot:acceptor`, and you can probably also use\n`hunchensocket:websocket-ssl-acceptor`.\n\n\n```lisp\n(defvar *server* (make-instance 'hunchensocket:websocket-acceptor :port 12345))\n(hunchentoot:start *server*)\n```\n\nNow open two browser windows on https://www.piesocket.com/websocket-tester\nenter `ws://localhost:12345/bongo` as the host and play around chatting with\nyourself.\n\nLicense\n-------\n\nSee [COPYING][copying] for license details.\n\nDesign\n------\n\nMain sources of inspiration:\n\n* Original implementation by Alexander Kahl, which cleverly hijacks\n  the Hunchentoot connection after the HTTP response and keeps the\n  connection alive, just like in a Head request.\n* [clws][clws]'s API because it explicitly defines websocket \"resources\"\n* [Hunchentoot's][Hunchentoot]'s API because it uses CLOS\n\nContributing\n------------\n\n* Propose patches using GitHub's pull request feature, as usual.  You\n  may ping the maintainers if you don't get some kind of feedback\n  after a week or so.\n\n* When composing a PR, it's OK to include nonessential\n  cleanup/housekeeping changes like fixing the odd bug, typo, or\n  indentation mishap.  But please segregate these changes into their\n  own separate commit.  You may freely `git rebase --interactice` and\n  `git push -f` to rewrite your PR if needed.\n\n* Each commit's message should strictly follow the GNU ChangeLog\n  format described [here][gnu-changelog].  It's what the Emacs project\n  uses.  There's a short subject line in the imperative form, followed\n  optionally by longer explanatory text, all formatted to less than 70\n  columns.  A bit like a nice text email from the twentieth century.\n  In the end there are entries for each file and\n  function/macro/top-level entity changed within it, along with very\n  brief descriptions of the change.  You can use `C-x 4 a` in Emacs to\n  help you generate these, if you want.\n\n  Here are some examples:\n\n```\nCloses #12: Avoid bordeaux-threads bug when nullifying locks\n\nElias Mårtenson noticed that its default implementation, the\nBT:WITH-LOCK-HELD macro evaluates its argument twice and thus\nnullifying that slot while holding it is not only unnecessary, but\nproblematic.\n\nSee https://github.com/joaotavora/hunchensocket/pull/12.\n\nThis fix is conceptually cleaner than the one proposed there.\n\n* hunchensocket.lisp (call-with-new-client-for-resource): Don't\n  nullify client's WRITE-LOCK while locking it.\n```\n\n```\nFix many bugs and add automatic tests for robustness.\n\n* hunchensocket-tests.lisp: New file.\n\n* hunchensocket.asd (:hunchensocket-tests): New system.\n(:hunchensocket): Depends on cl-fad.\n\n* hunchensocket.lisp (control-frame-p): New function.\n(websocket-client): Separate input and output stream slots. State\ngoes in client.\n(check-message): Receive fragment and total length.\n(send-text-message): Use SEND-FRAME.\n(close-connection, send-frame): New functions.\n(websocket-error): Add error status reader.\n(with-new-client-for-resource): Adapt to separate stream slots.\n(read-unsigned-big-endian): Fix big bug. Was reading little-endian!\n(read-frame): Optionally read payload. Error out when control\nframe is too large.\n(read-frame-from-client): New function.\n(mask-unmask): New function.\n(read-application-data): New function.\n(handle-frame): Rework completely. Bigger but slightly easier to\nread.\n(read-handle-loop): Simplify.\n(process-request): Use new WITH-NEW-CLIENT-FOR-RESOURCE.\n```\n\n\n[WebSocket]: http://en.wikipedia.org/wiki/WebSocket  \n[edi]: http://weitz.de/\n[kahl]: https://github.com/e-user/hunchensocket\n[RFC6455]: https://tools.ietf.org/html/rfc6455\n[clws]: https://github.com/3b/clws\n[copying]: https://github.com/joaotavora/hunchensocket/blob/master/COPYING\n[Hunchentoot]: http://weitz.de/hunchentoot/\n[Quicklisp]: http://www.quicklisp.org/  \n[gnu-changelog]: https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoaotavora%2Fhunchensocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoaotavora%2Fhunchensocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoaotavora%2Fhunchensocket/lists"}