Skip to content

Optimized low-level WebSocket protocol parser written in Common Lisp

Notifications You must be signed in to change notification settings

rabbibotton/fast-websocket

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fast-websocket

Build Status Coverage Status Quicklisp dist

Optimized low-level WebSocket protocol parser/composer.

Warning

This software is still BETA quality. The APIs will be likely to change.

Usage

(use-package :fast-websocket)

(let* ((ws (make-ws))
       (body (make-string-output-stream))
       (parser (make-parser ws
                            :require-masking t
                            :message-callback
                            (lambda (message)
                              (princ message body))
                            :close-callback
                            (lambda (payload &key code)
                              (format t "Client closed a connection: ~A (Code: ~D)~%" payload code)))))
  (funcall parser (make-array 11 :element-type '(unsigned-byte 8)
                              :initial-contents (list 129 133 225 106 10 29 169 15 102 113 142)))

  (princ (opcode-name (ws-opcode ws)))
  ;-> :TEXT

  (princ (get-output-stream-string body))
  ;-> Hello

  t)

(compose-frame "bye" :type :close :code (error-code :protocol-error))
;=> #(136 5 3 234 98 121 101)

Installation

cd ~/common-lisp
git clone https://github.com/fukamachi/fast-websocket
(ql:quickload :fast-websocket)

See Also

Author

Copyright

Copyright (c) 2015 Eitaro Fukamachi (e.arrows@gmail.com)

License

Licensed under the BSD 2-Clause License.

About

Optimized low-level WebSocket protocol parser written in Common Lisp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Common Lisp 100.0%