Giter VIP home page Giter VIP logo

Comments (5)

k911 avatar k911 commented on May 18, 2024

I don't think there is a need to port anything right now, because that would only complicate things. TBH, I'd like to get rid of current support for Doctrine Entity Manager too. I'm currently working on a more flexible configuration with the ability to dynamically attach handlers to different server events, so anyone could easily attach their own features by just implementing the interface.

Example configuration will look like this:

services:
  MyCustomRequestHandler:
    class: Vendor/RequestHandlers/MyCustomRequestHandler

swoole:
  server:
    listeners:
      - id: http 
        host: localhost
        protocol: tcp_dualstack
        port: 9501
        handlers:
          request:
           # predefined request handlers
           - symfonyRequestHandler
           - id: 'MyCustomRequestHandler' # reference to service in Symfony DI container
             priority: 200
          workerStart:
          - #... 
      # predefined listener
      - id: api
      # predefined listener with some changes
      - id: websocket
        tls:
           enabled: true
           key: 'key.pem'
           cert: 'cert.pem'
           ca: 'ca.pem'
          

Class Vendor/RequestHandlers/MyCustomRequestHandler could be even in user-space or in another Symfony bundle. It will just need to implement RequestHandlerInterface.

I'm working on these features on branch feat/dynamic-listeners if you'd like to try.

To summarize all of that:

  • There is no need to port anything regarding Doctrine project inside this bundle
  • There will be an easier configuration of custom event handlers for Swoole server's events (like handling request, tasks, etc.) so anyone could add the things they like
  • What I'm really interested in the future is the documentation how to easily integrate external bundles, like yours @Rastusik

from swoole-bundle.

Rastusik avatar Rastusik commented on May 18, 2024

I think I didn't explain clearly what I meant. My point was to remove doctrine code from this bundle and create something like a bridge, or what you call a custom request handler to call the doctrine code from this bundle: https://github.com/pixelfederation/doctrine-resettable-em-bundle . I think it is quite similar to your suggestion and maybe we should work out the details. Or do you see a bigger difference?

from swoole-bundle.

k911 avatar k911 commented on May 18, 2024

Yeah, I can agree to that, apart from removing things. I'd like to keep backward compatibility for some time, then deprecate and eventually remove it. Because it won't block us to introduce a new feature.

from swoole-bundle.

Rastusik avatar Rastusik commented on May 18, 2024

Ok, the removal can be postponed, no problem. So are you ok with me making a pull request for the mentioned integration? If yes, should I work with the feat/dynamic-listeners branch then?

from swoole-bundle.

k911 avatar k911 commented on May 18, 2024

Nope, as usual you should work with develop.

from swoole-bundle.

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.