Closed pebblexe closed 7 years ago
Also it seems that sometimes I am getting multiple responses, but they are duplicates.
(defvar *client* (wsd:make-client "ws://echo.websocket.org"))
(wsd:start-connection *client*)
(wsd:on :message *client*
(lambda (message)
(format t "~&Got: ~A~%" message)))
;; (format t "sent!")
;; (wsd:send *client* "Hi")
(defun send ()
(wsd:send *client* "Hi 1"))
And this is the response I am getting:
(wstest:send)
NIL
Got: Hi 1
Got: Hi 1
Got: Hi 1
Got: Hi 1
Got: Hi 1
Got: Hi 1
Got: Hi 1
Got: Hi 1
when I am only running the sending code once. Is that a bug? Why is it buffering?
Sorry for the odd question, I am new to common lisp.
Also it seems like it isn't responding with the actual output sometimes; it's just displaying a copy of the sent message as a response when tested against a non-echo server.
I don't have this problem. Have you upgraded your quicklisp?
I'm using the master branch of this and clack in my local-projects repository.
This is because of the way to invoke the file. Quicklisp won't load files again if those are already loaded and never changed since they were loaded. Try with REPL, it evaluates every time as you like. 2017年2月28日(火) 22:44 pebblexe notifications@github.com:
I'm using the master branch of this and clack in my local-projects repository.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fukamachi/websocket-driver/issues/16#issuecomment-283042407, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFhymQUOhzlh3AbfynxZTX99RJe2XZcks5rhCTPgaJpZM4MNT1w .
Ah that's it! That explains why it only runs sometimes. Thank you fukamachi!
But what about the second issue with the 'buffered' echoes? I don't seem to be able to interact normally with a websocket server, as https://github.com/jnordberg/wscat has shown I am not getting the proper responses returned.
And now I'm receiving nothing when sending to ws://echo.websocket.org:
CL-USER> (ql:quickload 'wstest)
To load "wstest":
Load 1 ASDF system:
wstest
; Loading "wstest"
(WSTEST)
CL-USER> (wstest:send)
NIL
CL-USER> (wstest:send)
NIL
CL-USER> (wstest:send)
NIL
CL-USER> (wstest:send)
NIL
CL-USER>
And now it's working after I restarted emacs!
(WSTEST)
CL-USER> (wstest:send)
NIL
Got: Hi 1
CL-USER> (wstest:send)
NIL
Got: Hi 1
CL-USER>
Okay, now I get it. For some reason when I start up and client is bound to ws://echo.websocket.org it works and echoes. But when I restart the code and aim it at another websocket server it remains stuck to the original one (the echo server) despite reloading (ql:quickload 'wstest).
Why does ql:quickload not rebind the client defvar properly?
I think this whole thing is me being an idiot; this is a wonderful library.
With the following code:
Produces the following output:
So why does it only get a 'Hi' the first time? It seems like the repeated requests are not being sent/received properly.