Coder Social home page Coder Social logo

Feature Proposal: Raxx.Context about raxx HOT 3 CLOSED

nietaki avatar nietaki commented on June 12, 2024 2
Feature Proposal: Raxx.Context

from raxx.

Comments (3)

CrowdHailer avatar CrowdHailer commented on June 12, 2024

I'm of the opinion that it is something we definitely want to do.
Having middleware without this just makes middleware unviable.
The reason being that something like an authentication middleware definitely requires being able to pass information to the controller.

That said I think in most applications one or two standard middleware will be all that's required. i.e. I don't think the average project should be defining many/any middleware.

The protocol upgrade stuff is interesting but I don't have anything useful to add. I'm not even sure it's worth giving much thought until someone tries implementing websockets or similar (if similar even exists, Is there anything like websockets but not websockets?)

My current goal is to go through the list of middleware that it would be nice to have (it exists on the raxx_kit proposals board) use the Process dictionary as need be and see what falls out.

The way I see it there are two questions

  • structured/unstructured for the data
  • Process dictionary or parameters for passing around.

I am leaning to process dictionary because if a middleware doesn't need to do anything with the context. For example imagine the following stack

Raxx.Session
MyNewMiddleware
Raxx.Flash

The flash middleware will need a few things from the session middleware, and the session middleware will need to know what was added/deleted by the flash middleware in the response.
Using the process dictionary allows MyNewMiddleware to be oblivious to the fact a context even exists

from raxx.

nietaki avatar nietaki commented on June 12, 2024

I thought about it some more and I am starting to believe putting it in the process dictionary is the way to go. Adding it to the behaviours would complicate them a fair bit, without much benefit in most situations.

You're right, probably not much point trying to fit in protocol upgrade at this point.

The implementation should be simple enough, the bulk of the task is going to be providing a good API for it. I think it makes sense for me to build up a PR with some working implementation and we can discuss the interface based on it.

from raxx.

tsloughter avatar tsloughter commented on June 12, 2024

The problem with the process dictionary I've hit with context is propagating to another process when needed.

For now I've simply gone with providing both options, process dictionary context or variable context. If you use the pdict context and want to propagate you must get the current context into a variable and pass it as part of a message.

Personally in the case of middlewares like this I'd go with a variable. We've discussed doing this in Elli and it is the way I do it in grpcbox.

from raxx.

Related Issues (20)

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.