Arcadia icon indicating copy to clipboard operation
Arcadia copied to clipboard

Socket repl timing issues?

Open sogaiu opened this issue 5 years ago • 2 comments

There is some work going on in trying to get Arcadia socket repl support in the Chlorine plugin for the Atom editor, and there appears to be some issue subsequent to a successful connection.

Upon connection to Arcadia's Socket repl port, what is sent is:

  • newline
  • reader-conditional form newline
  • keyword newline
\n
#?(:cljs :using-cljs-repl :clj :using-clj-repl :cljr :using-cljr-repl :joker :using-joker-repl :bb :using-bb-repl)\n
:using-unknown-repl\n

code:

       (.write conn "\n")
       (.write conn (str "#?(:cljs :using-cljs-repl :clj :using-clj-repl "
                         ":cljr :using-cljr-repl "
                         ":joker :using-joker-repl "
                         ":bb :using-bb-repl)\n"))
       (.write conn ":using-unknown-repl\n")

I see 2 prompts according to wireshark, but no evaluation results (wireshark output below):

user=> 
#?(:cljs :using-cljs-repl :clj :using-clj-repl :cljr :using-cljr-repl :joker :using-joker-repl :bb :using-bb-repl)
:using-unknown-repl
user=>

When I do this manually via nc, I see evaluation results for both with 3 prompts total (wireshark output below):

user=> #?(:cljs :using-cljs-repl :clj :using-clj-repl :cljr :using-cljr-repl :joker :using-joker-repl :bb :using-bb-repl)
:using-cljr-repl
user=> :using-unknown-repl
:using-unknown-repl
user=>

When I put the 2 forms in a file and nc it, I see one evaluation result and only 2 prompts (wireshark output below):

#?(:cljs :using-cljs-repl :clj :using-clj-repl :cljr :using-cljr-repl :joker :using-joker-repl :bb :using-bb-repl)
:using-unknown-repl

user=> :using-cljr-repl
user=>

From these experiments, I'm thinking there may be some timing issues.

Any thoughts?

sogaiu avatar Nov 10 '19 18:11 sogaiu

Chlorine author here, if you have any questions ping me.

By the way, the following code works:

       (js/setTimeout
        (fn []
          (.write conn (str "#?(:cljs :using-cljs-repl :clj :using-clj-repl "
                              ":cljr :using-cljr-repl "
                              ":joker :using-joker-repl "
                              ":bb :using-bb-repl)\n"))))
       (js/setTimeout
        (fn []
          (.write conn ":using-unknown-repl\n")))

mauricioszabo avatar Nov 10 '19 22:11 mauricioszabo

Strange, looking into it. I will try and reproduce on my machine when I can.

nasser avatar Nov 12 '19 15:11 nasser