0dbf9c90a6
- Slynk server - Formatting output - wait-for-clack-handler - The WebSocket snippet from https://lispcookbook.github.io/cl-cookbook/websockets.html adatpted instead of hx-sse extension - Persistent bottom navbar - white-space: nowrap
66 lines
1.7 KiB
Common Lisp
66 lines
1.7 KiB
Common Lisp
(in-package #:cl-user)
|
|
|
|
(defpackage #:live-chat-db
|
|
(:use #:cl)
|
|
(:local-nicknames (#:cl-dbi #:dbi))
|
|
(:export #:*db*
|
|
#:open-database
|
|
#:close-database
|
|
#:create-messages-table
|
|
#:insert-message
|
|
#:fetch-messages
|
|
#:clear-messages))
|
|
|
|
(defpackage #:live-chat-ui
|
|
(:use #:cl)
|
|
(:local-nicknames (#:cl-who #:cl-who))
|
|
(:import-from #:live-chat-db
|
|
#:insert-message
|
|
#:fetch-messages)
|
|
(:export #:set-subpath-prefix
|
|
#:render-chat-messages
|
|
#:render-chat-ui
|
|
#:handle-post-message
|
|
#:*messages*))
|
|
|
|
(defpackage #:live-chat-cgi
|
|
(:use #:cl)
|
|
(:import-from #:live-chat-ui)
|
|
(:export #:cgi-handler))
|
|
|
|
(defpackage #:live-chat-routes
|
|
(:use #:cl)
|
|
(:import-from #:live-chat-db
|
|
#:insert-message)
|
|
(:import-from #:live-chat-ui
|
|
#:handle-post-message
|
|
#:render-chat-messages
|
|
#:render-chat-ui)
|
|
(:local-nicknames (#:cl-who #:cl-who)
|
|
(#:myway #:myway))
|
|
(:export #:app))
|
|
|
|
(defpackage #:live-chat-ws
|
|
(:use #:cl)
|
|
(:import-from #:websocket-driver
|
|
#:make-client
|
|
#:make-server
|
|
#:on
|
|
#:send
|
|
#:start-connection
|
|
#:close-connection)
|
|
(:export #:make-websocket-server
|
|
#:handle-close-connection
|
|
#:broadcast-to-room
|
|
#:handle-new-connection
|
|
#:*connections*))
|
|
|
|
(uiop:define-package #:live-chat
|
|
(:use #:cl)
|
|
(:import-from #:clack #:clackup)
|
|
(:use-reexport #:live-chat-ui
|
|
#:live-chat-db
|
|
#:live-chat-routes))
|
|
|
|
(in-package #:live-chat)
|