Change dir structure and add README

master
Hugo Thunnissen 6 years ago
parent 45d0b6d2c4
commit 7bdbd47eab

@ -0,0 +1,4 @@
# Stomp.el - STOMP in elisp
This is a small elisp library with functions for parsing, recieving,
composing and sending STOMP frames. The functions can be used in
combination with emacs processes to recieve and send frames.

@ -0,0 +1,21 @@
(require 'map)
(load-file "/home/hugo/projects/stomp/stomp.el")
;; (setq proc (make-process
;; :name "stomp-client"
;; :buffer "Barry"
;; :command "nc localhost 61613"
;; :filter (stomp-filter-function (lambda (frame) (frame "%s" frame)))))
(setq proc (make-network-process
:name "stomp-client"
:buffer "stomp-frames"
:host "127.0.0.1"
:service 61613
:filter (stomp-filter-function (lambda (frame) (message "%s" frame)))))
(setq frame ())
(stomp-send-frame proc (map-put frame 'command "CONNECT"))
(stomp-send-frame proc '((command . "SUBSCRIBE") (headers ("destination" . "/queue/testing"))))

@ -1,20 +0,0 @@
(require 'map)
(load-file "/home/hugo/projects/stomp/stomp.el")
;; (setq proc (make-process
;; :name "stomp-client"
;; :buffer "Barry"
;; :command "nc localhost 61613"
;; :filter (stomp-filter-function (lambda (message) (message "%s" message)))))
(setq proc (make-network-process
:name "stomp-client"
:buffer "stomp-messages"
:host "127.0.0.1"
:service 61613
:filter (stomp-filter-function (lambda (message) (message "%s" message)))))
(setq message ())
(stomp-send-message proc (map-put message 'command "CONNECT"))

@ -3,7 +3,6 @@
(require 'map)
;; TODO: make this send more than just the command
(defun stomp-send-frame (process frame)
"Send a message to a STOMP process"
(process-send-string process (stomp-frame-to-string frame)))
@ -49,6 +48,7 @@
(map-put frame 'command (current-word))
(map-put frame 'headers (stomp-read-headers buffer headers-end-point))
;; TODO: take content-length header into account
;; This is might be hard to do if the content contains carriage returns.
(map-put frame 'content (buffer-substring (+ 1 headers-end-point) frame-end-point)))
(t nil)))))
@ -95,3 +95,5 @@
(alist-get 'command frame)
(mapconcat (lambda (h) (format "%s:%s\n" (car h) (cdr h))) headers "")
content)))
(provide 'stomp)

@ -10,7 +10,7 @@
(defun stomp-frame-buffer (test-file)
"Create a buffer with a stomp frame in it for testing purposes"
(find-file (format "%s/testdata/%s" cwd test-file)))
(find-file (format "%s/test/testdata/%s" cwd test-file)))
(defun simple-frame-buffer ()
"Simple buffer to be used for testing"
Loading…
Cancel
Save