Open saikyun opened 4 years ago
Hi Saikyun,
This is an unfinished research project. It's not ready for general consumption. There's useful code in here but you'll have to dive in and piece it together yourself.
All right, thanks. Feel free to close the issue. :)
Skickat från min iPhone
19 aug. 2020 kl. 11:46 skrev Arne Brasseur notifications@github.com:
Hi Saikyun,
This is an unfinished research project. It's not ready for general consumption. There's useful code in here but you'll have to dive in and piece it together yourself.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
@Saikyun if I may hazard a guess: check your JVM version?
FWIW, I just tried out the following (on a freshly checked out version):
Set up basic listener
user=> (def stop-server (t/start-server #(swap! clients conj %) 1357))
#'user/stop-server
Connect to it (I ran this in a different shell)
telnet localhost 1357
Sanity check
user=> clients
#object[clojure.lang.Atom 0x3419e23b {:status :ready, :val [{:socket #object[java.net.Socket 0x34b27915 "Socket[addr=/127.0.0.1,port=53386,localport=1357]"], :in #object[java.net.SocketInputStream 0x29eda4f8 "java.net.SocketInputStream@29eda4f8"], :out #object[java.net.SocketOutputStream 0x1b9776f5 "java.net.SocketOutputStream@1b9776f5"], :size #object[clojure.lang.Atom 0x5e048149 {:status :ready, :val [51 185]}], :screen #object[clojure.lang.Atom 0x79d9214d {:status :ready, :val nil}], :listeners #object[clojure.lang.Atom 0x3d5790ea {:status :ready, :val {:resize #object[trikl.core$make_client$fn__564 0x1dd7796b "trikl.core$make_client$fn__564@1dd7796b"]}}], :input-loop #object[clojure.core$future_call$reify__8439 0x67a3bd51 {:status :ready, :val nil}]} {:socket #object[java.net.Socket 0x57402ba1 "Socket[addr=/127.0.0.1,port=53388,localport=1357]"], :in #object[java.net.SocketInputStream 0x56913163 "java.net.SocketInputStream@56913163"], :out #object[java.net.SocketOutputStream 0x702b06fb "java.net.SocketOutputStream@702b06fb"], :size #object[clojure.lang.Atom 0xa18649a {:status :ready, :val [51 185]}], :screen #object[clojure.lang.Atom 0x5c534b5b {:status :ready, :val nil}], :listeners #object[clojure.lang.Atom 0x396639b {:status :ready, :val {:resize #object[trikl.core$make_client$fn__564 0x2b22a1cc "trikl.core$make_client$fn__564@2b22a1cc"]}}], :input-loop #object[clojure.core$future_call$reify__8439 0x62573c86 {:status :pending, :val nil}]}]}]
Show something to this client (this example is lifted from the README)
(t/render (last @clients) #_(t/stdio-client)
[:box {:x 10 :y 5 :width 20 :height 10 :styles {:bg [50 50 200]}}
[:box {:x 1 :y 1 :width 18 :height 8 :styles {:bg [200 50 0]}}
[:box {:x 3 :y 1}
[:span {:styles {:fg [30 30 150]}} "hello\n"]
[:span {:styles {:fg [100 250 100]}} " world"]]]])
Verify client view In the shell with my telnet session, I now see a red square with a blue border and "hello world" in the middle
Verify client state
user=> (type (last @clients))
clojure.lang.PersistentArrayMap
user=> (keys (type (last @clients)))
Execution error (IllegalArgumentException) at user/eval627 (REPL:1).
Don't know how to create ISeq from: java.lang.Class
user=> (keys (last @clients))
(:socket :in :out :size :screen :listeners :input-loop)
user=> (:socket (last @clients))
#object[java.net.Socket 0x57402ba1 "Socket[addr=/127.0.0.1,port=53388,localport=1357]"]
user=> (:size (last @clients))
#object[clojure.lang.Atom 0xa18649a {:status :ready, :val [51 185]}]
user=> (:listeners (last @clients))
#object[clojure.lang.Atom 0x396639b {:status :ready, :val {:resize #object[trikl.core$make_client$fn__564 0x2b22a1cc "trikl.core$make_client$fn__564@2b22a1cc"]}}]
(and attempting to show (:screen (@last clients))
will dump "all the noise", if you want to confirm the terminal screen state)
Hope that helps!
Thanks, I might have used a "strange" jvm version (graalvm dev). :) What version are you on?
Den ons 7 okt. 2020 kl 01:45 skrev Agam Brahma notifications@github.com:
@Saikyun https://github.com/Saikyun if I may hazard a guess: check your JVM version?
FWIW, I just tried out the following (on a freshly checked out version):
- Set up basic listener
user=> (def stop-server (t/start-server #(swap! clients conj %) 1357))
'user/stop-server
- Connect to it (I ran this in a different shell)
telnet localhost 1357
- Sanity check
user=> clients
object[clojure.lang.Atom 0x3419e23b {:status :ready, :val [{:socket #object[java.net.Socket 0x34b27915 "Socket[addr=/127.0.0.1,port=53386,localport=1357]"], :in #object[java.net.SocketInputStream 0x29eda4f8 "java.net.SocketInputStream@29eda4f8"], :out #object[java.net.SocketOutputStream 0x1b9776f5 "java.net.SocketOutputStream@1b9776f5"], :size #object[clojure.lang.Atom 0x5e048149 {:status :ready, :val [51 185]}], :screen #object[clojure.lang.Atom 0x79d9214d {:status :ready, :val nil}], :listeners #object[clojure.lang.Atom 0x3d5790ea {:status :ready, :val {:resize #object[trikl.core$make_client$fn564 0x1dd7796b "trikl.core$make_client$fn__564@1dd7796b"]}}], :input-loop #object[clojure.core$future_call$reify8439 0x67a3bd51 {:status :ready, :val nil}]} {:socket #object[java.net.Socket 0x57402ba1 "Socket[addr=/127.0.0.1,port=53388,localport=1357]"], :in #object[java.net.SocketInputStream 0x56913163 "java.net.SocketInputStream@56913163"], :out #object[java.net.SocketOutputStream 0x702b06fb "java.net.SocketOutputStream@702b06fb"], :size #object[clojure.lang.Atom 0xa18649a {:status :ready, :val [51 185]}], :screen #object[clojure.lang.Atom 0x5c534b5b {:status :ready, :val nil}], :listeners #object[clojure.lang.Atom 0x396639b {:status :ready, :val {:resize #object[trikl.core$make_client$fn564 0x2b22a1cc "trikl.core$make_client$fn__564@2b22a1cc"]}}], :input-loop #object[clojure.core$future_call$reify8439 0x62573c86 {:status :pending, :val nil}]}]}]
- Show something to this client (this example is lifted from the README)
(t/render (last @clients) #_(t/stdio-client) [:box {:x 10 :y 5 :width 20 :height 10 :styles {:bg [50 50 200]}} [:box {:x 1 :y 1 :width 18 :height 8 :styles {:bg [200 50 0]}} [:box {:x 3 :y 1} [:span {:styles {:fg [30 30 150]}} "hello\n"] [:span {:styles {:fg [100 250 100]}} " world"]]]])
1.
Verify client view In the shell with my telnet session, I now see a red square with a blue border and "hello world" in the middle 2.
Verify client state
user=> (type (last @clients)) clojure.lang.PersistentArrayMap user=> (keys (type (last @clients))) Execution error (IllegalArgumentException) at user/eval627 (REPL:1). Don't know how to create ISeq from: java.lang.Class user=> (keys (last @clients)) (:socket :in :out :size :screen :listeners :input-loop) user=> (:socket (last @clients))
object[java.net.Socket 0x57402ba1 "Socket[addr=/127.0.0.1,port=53388,localport=1357]"]
user=> (:size (last @clients))
object[clojure.lang.Atom 0xa18649a {:status :ready, :val [51 185]}]
user=> (:listeners (last @clients))
object[clojure.lang.Atom 0x396639b {:status :ready, :val {:resize #object[trikl.core$make_client$fn__564 0x2b22a1cc "trikl.core$make_client$fn__564@2b22a1cc"]}}]
(and attempting to show (:screen (@last clients)) will dump "all the noise", if you want to confirm the terminal screen state)
Hope that helps!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lambdaisland/trikl/issues/2#issuecomment-704610489, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS46Z7MISY6UTYNOTRK5FLSJOTZJANCNFSM4QEVOLVQ .
I'm trying to follow along the example. I start a socket repl, and eval the following lines:
Then when connecting using
telnet localhost 1357
I get the following exception in the repl window:I'm on MacOS. Have tried connecting using
eshell
andshell
in emacs, andzsh
terminal.