Git Product home page Git Product logo

nrepl-middleware's Introduction

NREPL Middleware GitHub Actions status |pink-gorilla/gorilla-middlewareCodecov ProjectClojars Project

features

  • nrepl websocket relay (browsers can not connect to normal tcp ports)
  • nrepl middleware that renders evalued results from notebook session
  • nepl middlewre that sniffs evals on other nrepl session
  • nrepl client (clj and cljs)on core.async

Middleware cli demo

To test picasso and sniffer middleware run 3 different terminal windows and execute this 3 commands in this order

clojure -X:relay  ; this runs jetty http server with websocket relay (port 9000)
clojure -M:client -m sink   ; will listen to sniffed evals
clojure -M:client -m ide -i ./snippets/sniffer.edn 
clojure -M:client -m ide -i ./snippets/sniffer-min.edn

 ; will do a few evals that wil show up on listen

WebRelay websocket demo

To see a simple websocket frontend, run in 2 terminal windows:

clojure -M:relay  ; this runs jetty http server with websocket relay (port 9000)
clojure -M:demo         ; browser app served with shadow-cljs dev server port 8000

Design of websocket relay

Server

  • Browser can only do websocket and not normal sockets.
  • Server Relay runs as ring request-handler, and returns new websocket handler
  • the websocket handler creates a new nrel client connection, and then forwards requests in both ways.
  • currently we create nrepl server to connect to.

Browser:

  • The code is spit into several stateful components.
  • layer1 is websocket connection. Provides two core async channels. Manages connection / reconnection.
  • layer2: request router. Manages pending requests, returns for each nrepl-op a dedicated return channel, which is sent fragment by fragment. The request channel will be closed after the last fragment is received.
  • layer3:

Logging:

  • Lots of logging with timbre at DEBUG level
  • If you dot want lots of output, set loglevel to INFO

Test if javadoc is installed:

clj -Srepro -e "(import '(jdk.javadoc.doclet Doclet))"

nrepl-middleware's People

Contributors

awb99 avatar deas avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

nrepl-middleware's Issues

remote nrepl - add middleware

nrepl-ws-relay remote nrepl
connect to remote nrepl without client middleware setup?
add-middleware loading works. ("add-middleware")
but in which scenario does this make sense?

relay - closed sessions

repl-ws-relay close session
close of nrepl sessions:
if client drops, a timeout needs to detect a closed session this is not implemented yet,
to close a nrepl session, the session id needs to be known. this means we have to read all messages that get forwarded, because otherwise an {:op "clone"} could reset it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.