Giter Site home page Giter Site logo

Comments (12)

cristhianfernandez01 avatar cristhianfernandez01 commented on May 11, 2024 1

Sorry for delay in replying. I was doing some tests because I appeared again the error mentioned at the beginning of the issue:

 The service "gos_web_socket.router.wamp" has a dependency on a non-existent service   "gos_pubsub_router.websocket".

My mistake was that they did not include the bundle pubsub to AppKernel.php. Now that the server did worked properly, i.e. the error disappeared.
But now my problem is that when I define a route in my AppBundle / Resources / config / pubsub / routes.yml file as follows:

    app_topic_chat:
        channel: app/chat/{user_id}
        handler:
            callback: 'app.topic' 
        requirements:
            user_id:
                pattern: "\d+"

And when I use this code in the client's view (chat.html.twig):

var websocket = WS.connect("ws://127.0.0.1:8080");
myWebSocket.on("socket/connect", function(session){
         session.subscribe("app/chat/32", function(uri, payload){
        console.log("Received message", payload.msg);
    });
    console.log("Successfully Connected!");
})

myWebSocket.on("socket/disconnect", function(error){
    console.log("Disconnected for " + error.reason + " with code " + error.code);
})

I have the following error:

         ERROR: Unable to find route for app/chat/32

I don`t understand how to define correctly the routes for this.
I have also defined a Topic class with getName () appropriate (return 'app.topic '; ) and i configure this Topic as a service. I have also configured the bundle WebSocketBundle this:

gos_web_socket:
    server:
        host: 127.0.0.1
        port: 8080
        router:
            resources:
                - @AppBundle/Resources/config/pubsub/routing.yml

Could you give me a clue as to clearly define these routes ?. Because of that I'm lost
Thanks for you patience

from websocketbundle.

jjsaunier avatar jjsaunier commented on May 11, 2024

Thank you for reporting it. I think I must start to tag pubsub router to avoid this.

First you don't need to install pubsub router by yourself because he is already loaded by websocket bundle & configured (you just have to add your routing file).

I will fix it as soon as possible

from websocketbundle.

cristhianfernandez01 avatar cristhianfernandez01 commented on May 11, 2024

Thank you very much for your quick response. I will be aware

from websocketbundle.

jjsaunier avatar jjsaunier commented on May 11, 2024

I have released v1.0.2, run composer update, it should solved it ! :)

BTW, if you continue the installation until the routing configuration it work.

from websocketbundle.

cristhianfernandez01 avatar cristhianfernandez01 commented on May 11, 2024

It worked perfectly. Thank you very much again for your help. The bundle is excellent

from websocketbundle.

jjsaunier avatar jjsaunier commented on May 11, 2024

The bundle is excellent

Thank you very much !

from websocketbundle.

cristhianfernandez01 avatar cristhianfernandez01 commented on May 11, 2024

How do I make so you can use the routes with the bundle PubSubRouter? Because if I set routes through the option "router" I'm aking the same problem, ie I get the same error. Otherwise, how could do to dispense with this bundle (PubSubRouter)?

from websocketbundle.

jjsaunier avatar jjsaunier commented on May 11, 2024

Sorry but i don't understand :(

WebsocketBundle forward all configs under "router" key to "PubSubRouter" in order to keep the installation very easy.

Here an example : https://github.com/ProPheT777/real_time_bidirectional_notification-symfony2-redis-websocket-pubsub/commits?author=ProPheT777

-> May be the doc is wrong ?

from websocketbundle.

jjsaunier avatar jjsaunier commented on May 11, 2024

My mistake was that they did not include the bundle pubsub to AppKernel.php. Now that the server did worked properly, i.e. the error disappeared.

Nice catch, I forgot to update this docs section, I fixed it.

For the second part, it can be a miss configuration.

You said that you have defined the routing definition in AppBundle / Resources / config / pubsub / routes.yml

and in your configuration you have

gos_web_socket:
    server:
        host: 127.0.0.1
        port: 8080
        router:
            resources:
                - @AppBundle/Resources/config/pubsub/routing.yml

According to your routing file name it should be :

gos_web_socket:
    server:
        host: 127.0.0.1
        port: 8080
        router:
            resources:
                - @AppBundle/Resources/config/pubsub/routes.yml

from websocketbundle.

jjsaunier avatar jjsaunier commented on May 11, 2024

I have created a demo project from scratch available here : https://github.com/GeniusesOfSymfony/WebsocketAppDemo

I got one issue and update the docs : When I register new routing file in config.yml I must clear cache for take it into account and make switch the container to NullRouter to WampRouter.

I hope that will help you.

from websocketbundle.

cristhianfernandez01 avatar cristhianfernandez01 commented on May 11, 2024

Thank you very much for the demo application. I resolved my problem. I was making a mistake by naming the route (it was "app / chat" and wrote "app / channel" on file "chat.html.twig"). He also helped me the change of PubSubRouter bundle (requeriments on the route can be empty). Forgive me for delay in reply and thank you very much again for your help. :)

P.S. Why could make inquiries half if needed?

from websocketbundle.

jjsaunier avatar jjsaunier commented on May 11, 2024

ok, nice to hear that :) !

Why could make inquiries half if needed?

I'm sorry but I don't understand what you mean.

from websocketbundle.

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.