Giter Club home page Giter Club logo

thruwaybundle's People

Contributors

achilleash avatar davidwdan avatar easen avatar eichie avatar karser avatar kcivey avatar mbonneau avatar megazoll avatar saidmoya12 avatar tacman avatar tnajanssen avatar valepu avatar youmad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thruwaybundle's Issues

thruway and docrtine

Perhaps this is a newbie question; how can i provide doctrine.orm.default_entity_manager via dependency injection to my class (for example as construct parameter)? I tried the default approach, as in to declare my class in the services.xml and provide it as argument, but the parameter mapping does not seem to be applied. In fact, in the cache, the object is created as clean (i.e. no parameters). My symfony version is 2.8.

Change IP Router

Hi,
I would change in config.yml the default ip (127.0.0.1) that the router should start on.
But in this case, when i start with the command by default : nohup php ... the router don't start with the log message : could not connect : connection refused.
My OS Server is Fedora 21 and firewalld is disabled for testing.

Any idea ?

Thanks

Push message to specific user

Hi!

I'm trying to implement notifications in my project. My use case:
User 1 creates Task 1 and subscribes to "tasks" channel.
User 2 edits Task 1 and subscribes to "tasks" channel.
User 1 must receive notification about task edit, and User 2 should not receive this notification.

I see in docs:

$client = $this->container->get('thruway.client');
$client->publish("com.myapp.hello_pubsub", [$value]);

But as I understand, this code publishes message to all subscribed users.

Is there a way to push message for specific User, and not for all?

How call/publish from another service/controller

Hi,

i have registered some wamp methods in php, when i call it from javascript works great, this also work in the same controller where are methods registered

but

when i need call it from another service/controller (i need publish, or call call with publish in), i give error like this - wamp.error.not_authorized

2015-10-29T13:11:42.1927460 notice [Thruway\Peer\Client 22073] Changing PHP precision from 14 to 16 2015-10-29T13:11:42.1948920 info [Thruway\Peer\Client 22073] New client created 2015-10-29T13:11:42.1958070 info [Thruway\Transport\PawlTransportProvider 22073] Starting Transport 2015-10-29T13:11:42.2112130 info [Thruway\Transport\PawlTransportProvider 22073] Pawl has connected 2015-10-29T13:11:42.2177340 debug [Thruway\Transport\PawlTransportProvider 22073] Received: [3,{},"wamp.error.not_authorized"] 2015-10-29T13:11:42.2179390 debug [Thruway\Peer\Client 22073] Client onMessage: [Thruway\Message\AbortMessage] 2015-10-29T13:11:42.2182040 warning [Thruway\Transport\PawlTransportProvider 22073] Exception occurred during onMessage: Got the following error when trying to call 'myCallMethod': wamp.error.not_authorized 2015-10-29T13:11:42.2183570 info [Thruway\Transport\PawlTransportProvider 22073] Pawl has closed

any idea where is problem please? its needed authenthicate php client, if yes, how? or another way to do publish in other service/controller?

thanks

How to know the active connections?

Hi,

I try to develop a web chat system with ThruwayBundle and I got a advanced question.

How to know the active connections?

The example situation:
If one topic has three users, A, B, C. if user A and B are stay in chatroom, but user C didn't.
When the chat system publishes a message in backend, if I can get active connections then I will know user C is not receive the message, so I can use the other way to send notification for user C.

Thank you for your time.

unable to publish to client from controller

im trying to publish message to connecting client from server but client was unable to receive any msg from server, i try to use xdebug to debug the code, somehow ClientManager's publish function cant find wamp_kernel in the container and thus skip $session.publish(...) code, i not sure if i missed out any configuration

this is how i publish my msg from server controller

public function testingAction() {
        $client = $this->container->get('thruway.client');
        $client->publish("com.myapp.hello_pub_sub", ['aaa']);
}

this is my browser code

<!DOCTYPE html>
<html>
<head>
    <title></title>
	<meta charset="utf-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1"/>
    <script type="text/javascript" src="js/autobahn.min.js"></script>
</head>
<body>
<script>
    var user = "userid";
    var key = "12345";
    function onchallenge(session, method, extra) {
        console.log(method, extra);
        if (method === "wampcra") {
            var keyToUse = key;
            if (typeof extra.salt !== 'undefined') {
                keyToUse = autobahn.auth_cra.derive_key(key, extra.salt);
            }
            console.log("authenticating via '" + method + "' and challenge '" + extra.challenge + "'");
            return autobahn.auth_cra.sign(keyToUse, extra.challenge);
        } else {
            throw "don't know how to authenticate using '" + method + "'";
        }
    }
    var connection = new autobahn.Connection({
        url: 'ws://127.0.0.1:8082',
        realm: 'realm1',
        authmethods: ["wampcra"],
        authid: user,
        onchallenge: onchallenge
    });
    connection.onopen = function (session, details) {
        console.log("connected session with ID " + session.id);
        console.log("authenticated using method '" + details.authmethod + "' and provider '" + details.authprovider + "'");
        console.log("authenticated with authid '" + details.authid + "' and authrole '" + details.authrole + "'");
        /*session.call('com.example.add', [3, 5]).then(
                function (res) {
                    console.log("Call 'com.example.add' result:", res);
                },
                function (error) {
                    console.log("Call Error:", error.error);
                }
        );*/
        //subscribe to a topic
        function onevent(args) {
            console.log('Subscribe message:', args);
        }
        session.subscribe('com.myapp.hello_pub_sub', onevent).then(
                function (subscription) {
                    console.log("subscription", subscription);
                },
                function (error) {
                    console.log("subscription error:", error);
                }
        );
		
		session.publish('com.myapp.hello_pub_sub', ['Hello, world222!']);
    };
	
    connection.onclose = function () {
        console.log("disconnected", arguments);
    };
    connection.open();
</script>


</body>
</html>

my config:

voryx_thruway:
    user_provider: 'fos_user.user_provider.username'
    realm: 'realm1'
    url: 'ws://127.0.0.1:8082' 
    router:
        ip: '127.0.0.1'  
        port: '8082'  
        trusted_port: '8081' 
        authentication: true 
    locations:
        bundles: ["AppBundle"]

How to prevent RPC registered on server from disappearing

I registered RPC on server with annotation

/**
*@Register("games.snake.newplayer",serializerEnableMaxDepthChecks=true, worker="add-snake")
*/

and I can call it but when I leave let's say for 5-10 minutes it is no longer available and I must restart server to make it available again.

To run server I am using command:

nohup php app/console thruway:process start & 

How to use the AuthorizationManager

When starting the router with thruway:router:start or thruway:process, the default AutorizationManager is AllPermissiveAuthorizationManager. I want to: either use the default AuthorizationManager or build a custom one, since I have the exact same requirements as #26 (not merged yet). Is there any better way to do this except creating a new command and setting an AuthorizationManagerInterface instance on the server (voryx.thruway.server)?
Can you please give me some guidance for the best approach on making this work?

Authentication no work.

I cannot enable the cra auth with FOSUserBundle.

Platform
Symfony 3.1
FOSUserBundle dev/master

#config.yml
voryx_thruway:
    realm: 'realm1'
    url: 'ws://127.0.0.1:8081'
    router:
        ip: '127.0.0.1'
        port: '9090'
        trusted_port: '8081'
        authentication: true
    locations:
        bundles: ["AppBundle"]
    user_provider:  'fos_user.user_manager'
#services.yml
wamp_cra_auth:
    class: Thruway\Authentication\WampCraAuthProvider
    parent: voryx.thruway.wamp.cra.auth.client
    tags:
        - { name: thruway.internal_client  }

doctrine.listener.e_listener:
    class: AppBundle\EventListener\DoctrineListener
    arguments: ["@service_container"]
    tags:
        - { name: doctrine.event_subscriber, connection: default }
//Client
var connection = new autobahn.Connection({
    url: 'ws://127.0.0.1:9090',
    realm: 'realm1',
    authmethods: ["wampcra"],
    authid: this.user.username,
    onchallenge: this._onchallenge //never trigger
});

connection.onopen = function (session, details) {
    console.log("connected session with ID " + session.id); //work
}

connection.open();

Verbosity, path to error log (Feature Request)

I'm getting an error when starting the thruway process

2015-06-25T09:17:55.4411180 info       [Thruway\Role\Callee 25043] Setting registration_id for com.survos.sqs.receive_messages (1)
[router 0 25040] Error... see log for more info

Unfortunately, I can't find the log in /var/log, or in the directory I started with, or even know the name of the log (I assume it's thruway.log). So some feature requests:

  • replace "see log for more" with "see log [FILENAME] for more"
  • instead of "Error", some slightly more detailed error -- "Port Unavailable", "Bad Service", etc.
  • the --verbose flag doesn't do anything, but I'd love to just dump the error right here in the terminal

Thanks!

Update Readme

Hi,
A small contribution.

use Voryx\ThruwayBundle\Annotation\RPC; cannot be resolved.

/**

  • @worker("chat", maxProcesses="5")
    */
    class ChatController

need : use Voryx\ThruwayBundle\Annotation\Worker;

Thank you.

Sorry for my english basic. I am French.

examples

can i find any examples for registering a topic ?

add authorization for auto-created realm

Hello,

I have a question. I managed to implement a authorization module for my router:

$authorizationManager = new \Thruway\Authentication\AuthorizationManager('testrealm');

$rule = new stdClass();
$rule->role = "teacher";
$rule->action = "register";
$rule->uri = "cnf.quiz.addstudent";
$rule->allow = true;

$authorizationManager->addAuthorizationRule([$rule]);

Whenever a new user is connecting and the realm doesn't exist, it creates it:

[Thruway\RealmManager 31922] Got prehello...
[Thruway\RealmManager 31922] Creating new realm "01234"
[Thruway\RealmManager 31922] Adding realm "01234"

But the authorization doesn't aply for this newly created realm. Is there a way to add the authorization to the newly auto created realm?

voryx_thruway.enable_logging doesn't act as expected

When setting voryx_thruway.enable_logging flag to false, the code in VoryxThruwayExtension.php is called only on the first run. When you relaunch the command a bit later, the log is still displayed on the console.

A suggestion would be to connect the Symfony 'logger' service to the Thruway\Logging\Logger so that the command can take benefit of -v -vv and -vvv options.

It is easy to achieve that outside of ThruwayBundle using the following code:

use Symfony\Component\Console\Event\ConsoleCommandEvent;

use Psr\Log\NullLogger;
use Thruway\Logging\Logger;

class SetVoryxLoggerListener
{

    public function onConsoleCommand(ConsoleCommandEvent $event)
    {
        Logger::set($event->getDispatcher()->getContainer()->get('logger'));
    }
}

And declare a service:

    voryx.thruway.setvorxylogger:
        class: Visioglobe\MapEditorBundle\Listener\SetVoryxLoggerListener
        tags:
            - { name: kernel.event_listener, event: console.command }

How to avoid wired response message show in backend?

Hi,

I try to develop a web chat system with ThruwayBundle, but I got a stuck situation.
When I try to publish message in backend, I got some wired response message.

screenruler-e824e513-0bd3-4ca5-846f-367f6568cc41

my backend code in Symfony:

$client = $this->container->get('thruway.client');
$client->publish("user.line.thread.55122ab298dee4fb020041b9", ['message sent from backend.']);  

My question is How to avoid that messages?

Thanks

By the way, I also check my config.yml setting. I did disable logging display.
voryx_thruway:
realm: 'myrealm'
enable_logging: false

Accessing the opened client's session from elsewhere

Hi!

I'm trying to figure out how to do this...

I'm using a Symfony Command to start my Thruway Router AND initializing my Client at the same time (pretty much like in ThruwayClientCommand except that my copy is using my SocketClient class which itself extends Thruway\Peer\Client).

Completely outside of the loop and not even within my browser, an event happens and calls a method of an ObjectManager class that I have. I need that ObjectManager's method to be able to publish to the socket that is already running from my cli Command.

How would I go about doing this? Am I not seeing it the right way? Should I be creating a new client just for this?

Thanks!

Connection lost when idle even with "keep alive"

I've already submitted this issue in this topic: #46
But since i got no answer i wanted to make a new issue for this.

I launch the server from comand line and if i don't publish anything for some time (about 20-30 minutes) i get what looks like a log of all the previous calls (just like in the other issue) on the console and the server just hangs (the process is active, but it doesn't accept connections anymore).
Following the suggestion on the other issue i have made a topic where i publish every 5 minutes. Now it lasts some hours (about 6-7) but then the same thing happens eventually.

Is it possible to know what is causing the issue? I don't think a "keep alive" mechanism should be needed at all in the first place

I am working on a windows 10 machine using PHP 5.6 and dev-master version of the bundle (but it happened even with the latest release, and even with PHP 7.1)

getting authentication errors

after thruway bundle runs longer than a few minutes.

any ideas? will debug as soon as i know this is not known / you are working on this.

MySQL server has gone away

Hi,

We are having this issue after an extended period of inactivity, usually overnight, where when the first query after this period is throwing this error Warning: PDOStatement::execute(): MySQL server has gone away

We put in a fix for this by closing and reopening the database connection but this just threw a new issue after the inactivity of Warning: Error while sending QUERY packet.

Has anyone had this before or know of a fix for this? It looks like it is happening after the 8 hour wait_timout in mysql.

I have also seen there is a cleanup function in the WampKernel that looks like it should be resetting the connections?

Thanks

publish method argument

$client->publish("com.myapp.helloPubSub", [$value]);

when i send the value parameter anything other than array it doesn't work, any idea why?

Documentation/Examples

Stumbled across this repo by accident and it's an absolutely brilliant effort for the shortfalls of Ratchet!

Is there any chance that documentation could go with this?

If not, is there an example that combines all of the advanced topics for a server-side router, that includes authentication, realms, pubsubs, RPC, etc.?
Might have a go at writing some docs for this if I understood it better :)

Kernel is not registered in Worker

I have a worker which throws the following exception: "You have requested a synthetic service ("kernel")". The DIC does not know how to construct this service.". After some debugging, it seems that the container used in the worker controller does not have the "kernel" service registered. The thruway_client service has the kernel service, but is not available in the controller. The kernel service is required by the file locator service in the appProdProjectContainer.php:

protected function getFileLocatorService()
    {
        return $this->services['file_locator'] = new \Symfony\Component\HttpKernel\Config\FileLocator($this->get('kernel'), ($this->targetDirs[2].'/Resources'));
    }

Any ideas how to avoid this issue?

`Worker` needs to be qualified differently if using pthreads

If you have the pthreads extension enabled, the @Worker annotation may not work properly.

You may receive the error:

[Symfony\Component\Config\Exception\FileLoaderLoadException]                                                                                                           
  [Semantical Error] The class "Worker" is not annotated with @Annotation. Are you sure this class can be used as annotation? If so, then you need to add @Annotation t  
  o the _class_ doc comment of "Worker". If it is indeed no annotation, then you need to add @IgnoreAnnotation("Worker") to the _class_ doc comment of class AppBundle\  
  Controller\YourController in ...

This is because pthreads has a Worker class in the global namespace and Doctrine Annotations gets confused.

You can work around this issue by using a differently qualified annotation (use the full namespace for example: @Voryx\ThruwayBundle\Annotation\Worker("my_worker") or by disabling pthreads.

How to react to on client connect

Hi,

Thanks so much for this easy to use bundle!
I have a very simple setup and would like to know if its possible to react to a client connecting to the default realm?
This is my config:

voryx_thruway:
    realm: 'realm1'
    url: 'ws://127.0.0.1:8000' #The url that the clients will use to connect to the router
    router:
        ip: '127.0.0.1'  # the ip that the router should start on
        port: '8000'  # public facing port.  If authentication is enabled, this port will be protected
        authentication: false # true will load the AuthenticationManager
    locations:
        bundles: ["AppBundle"]

I would greatly appreciate any pointers ๐Ÿ™

Connection lost after idle

Hi!
I use your bundle and autobahnjs to create real-time web app. All works fine, but after some idle time connection between client and server lost.
I get on frontend:

Connection lost Object {reason: null, message: null, retry_delay: 1.54782944253703, retry_count: 1, will_retry: true}

And on backend:

php_1            | [router 0 21] 2016-10-24T12:10:32.8671780 debug      [Thruway\Peer\Router 22] onClose from {"type":"ratchet","transportAddress":"172.18.0.5"}
php_1            | 2016-10-24T12:10:32.8677610 debug      [Thruway\Role\Broker 22] Broker onMessage for {"type":"dummyTransport","transportAddress":"dummy"}: [16,298986786785729,{},"wamp.metaevent.session.on_leave",[{"realm":"sales","authprovider":null,"authid":"eyJ0eXAiOiJKV1QiLCJhbG21ciOiJIUzI1NiJ9.eyJpZCI6Ijk1YTgwN123zhjLTI1ZjEtNGYxOC05YjA1LTMwZGM1YWY5NjlkZSIsImVtYWlsIjoiYWRtaW5AZXhhbXBsZS5jb20iLCJyb2xlIjoiYWRtaW4iLCJuYW1lIjoiUmVuYXRlIiwiZmFjZWJvb2tJZCI6bnVsbCwiZ29vZ2xlSWQiOm51bGwsImxpbmtlZGluSWQiOm51bGwsImFjdGl2ZSI6dHJ1ZSwic3ViIjoidXNlciIsImV4cCI6MTQ3NzM5NzEyMX0.tPWtuPCzXlLBVGRPlI_vq9RUkjp00giwOOs4bGvxgg1","authrole":"user","authroles":["user","authenticated_user"],"authmethod":"wampcra","session":2154130370063314,"role_features":{"caller":{"features":{"caller_identification":true,"progressive_call_results":true}},"callee":{"features":{"caller_identification":true,"pattern_based_registration":true,"shared_registration":true,"progressive_call_results":true,"registration_revocation":true}},"publisher":{"features":{"publisher_identification":true,"subscriber_blackwhite_listing":true,"publisher_exclusion":true}},"subscriber":{"features":{"publisher_identification":true,"pattern_based_subscription":true,"subscription_revocation":true}}}}]]
php_1            | 2016-10-24T12:10:32.8679650 debug      [Thruway\Realm 22] Leaving realm sales
php_1            | 2016-10-24T12:10:32.8681130 info       [Thruway\Transport\RatchetTransportProvider 22] Ratchet has closed
php_1            | [router 0 21] 2016-10-24T12:10:35.0081080 debug      [Thruway\Transport\RatchetTransportProvider 22] RatchetTransportProvider::onOpen
php_1            | [router 0 21] 2016-10-24T12:10:35.0086120 info       [Thruway\Peer\Router 22] New Session started {"type":"ratchet","transportAddress":"172.18.0.5"}
php_1            | [router 0 21] 2016-10-24T12:10:35.0149500 debug      [Thruway\Transport\RatchetTransportProvider 22] onMessage: ([1,"sales",{"roles":{"caller":{"features":{"caller_identification":true,"progressive_call_results":true}},"callee":{"features":{"caller_identification":true,"pattern_based_registration":true,"shared_registration":true,"progressive_call_results":true,"registration_revocation":true}},"publisher":{"features":{"publisher_identification":true,"subscriber_blackwhite_listing":true,"publisher_exclusion":true}},"subscriber":{"features":{"publisher_identification":true,"pattern_based_subscription":true,"subscription_revocation":true}}},"authmethods":["wampcra"],"authid":"eyJ0eXAiOiJKV1QiLCJhbG21ciOiJIUzI1NiJ9.eyJpZCI6Ijk1YTgwN123zhjLTI1ZjEtNGYxOC05YjA1LTMwZGM1YWY5NjlkZSIsImVtYWlsIjoiYWRtaW5AZXhhbXBsZS5jb20iLCJyb2xlIjoiYWRtaW4iLCJuYW1lIjoiUmVuYXRlIiwiZmFjZWJvb2tJZCI6bnVsbCwiZ29vZ2xlSWQiOm51bGwsImxpbmtlZGluSWQiOm51bGwsImFjdGl2ZSI6dHJ1ZSwic3ViIjoidXNlciIsImV4cCI6MTQ3NzM5NzEyMX0.tPWtuPCzXlLBVGRPlI_vq9RUkjp00giwOOs4bGvxgg1"}])
php_1            | [router 0 21] 2016-10-24T12:10:35.0155000 debug      [Thruway\Realm 22] Got Hello
php_1            | [router 0 21] 2016-10-24T12:10:35.0173820 debug      [Thruway\Authentication\WampCraAuthProvider 22] Client onMessage: [Thruway\Message\InvocationMessage]
php_1            | [router 0 21] 2016-10-24T12:10:35.0200560 debug      [Thruway\Authentication\AuthenticationManager 22] Client onMessage: [Thruway\Message\ResultMessage]
php_1            | [router 0 21] 2016-10-24T12:10:35.0951650 debug      [Thruway\Transport\RatchetTransportProvider 22] onMessage: ([5,"JsqDL9nUHfpFsRJOy9cQy6uXP8PWeDUeExoHI9nJkW8=",{}])
php_1            | [router 0 21] 2016-10-24T12:10:35.0962210 debug      [Thruway\Authentication\WampCraAuthProvider 22] Client onMessage: [Thruway\Message\InvocationMessage]
php_1            | [router 0 21] 2016-10-24T12:10:35.0968600 debug      [Thruway\Authentication\AuthenticationManager 22] Client onMessage: [Thruway\Message\ResultMessage]
php_1            | [router 0 21] 2016-10-24T12:10:35.0974710 debug      [Thruway\Role\Broker 22] Broker onMessage for {"type":"dummyTransport","transportAddress":"dummy"}: [16,5800741427391633,{},"wamp.metaevent.session.on_join",[{"realm":"sales","authprovider":null,"authid":"eyJ0eXAiOiJKV1QiLCJhbG21ciOiJIUzI1NiJ9.eyJpZCI6Ijk1YTgwN123zhjLTI1ZjEtNGYxOC05YjA1LTMwZGM1YWY5NjlkZSIsImVtYWlsIjoiYWRtaW5AZXhhbXBsZS5jb20iLCJyb2xlIjoiYWRtaW4iLCJuYW1lIjoiUmVuYXRlIiwiZmFjZWJvb2tJZCI6bnVsbCwiZ29vZ2xlSWQiOm51bGwsImxpbmtlZGluSWQiOm51bGwsImFjdGl2ZSI6dHJ1ZSwic3ViIjoidXNlciIsImV4cCI6MTQ3NzM5NzEyMX0.tPWtuPCzXlLBVGRPlI_vq9RUkjp00giwOOs4bGvxgg1","authrole":"user","authroles":["user","authenticated_user"],"authmethod":"wampcra","session":5419777708509425,"role_features":{"caller":{"features":{"caller_identification":true,"progressive_call_results":true}},"callee":{"features":{"caller_identification":true,"pattern_based_registration":true,"shared_registration":true,"progressive_call_results":true,"registration_revocation":true}},"publisher":{"features":{"publisher_identification":true,"subscriber_blackwhite_listing":true,"publisher_exclusion":true}},"subscriber":{"features":{"publisher_identification":true,"pattern_based_subscription":true,"subscription_revocation":true}}}}]]

After this subscription doesn't exists.

Is there a way to avoid this without resubscribe? For example, send some pings from server to client.

JMS Serializer, API Platform and Thruway

We're having issues running API Platform and Thruway together. We've removed JMS Serializer from our project, and would prefer just to use Symfony's.

The problem is that Thruway installs JMS Serializer, which then uses the name 'Serializer'.

Is there a way to avoid this conflict? We can fork it, but perhaps there's a way to set an alias or class of the Serializer?

PHP client not connecting to server, not sure how to debug

Hi,

I have a problem where publishing from the PHP client doesn't work. There's no obvious errors, the client just doesn't appear to connect to the router. Clients connected using Autobahn.js work fine

Here is my config

voryx_thruway:
    realm: 'realm1'
    url: 'ws://127.0.0.1:8881' #The url that the clients will use to connect to the router
    router:
        ip: '127.0.0.1'  # the ip that the router should start on
        port: '8880'  # public facing port.  If authentication is enabled, this port will be protected
        trusted_port: '8881' # Bypasses all authentication.  Use this for trusted clients.
        authentication: true

And here is the line in my controller which is supposed to send the message:

$this->get('thruway.client')->publish('test.event', ['hello there']);

I'm guessing the connection fails for some reason between the PHP client and the server, but I can't find any errors anywhere. Is there something I've missed?

How to use Register with location setting?

Hi,

I try to use a register controller, but I got some problems.
Here is my config setting and code:

voryx_thruway:
...
    locations:
#        bundles: ["OZLineBundle"]
        files:
            - "OZ\\LineBundle\\Controller\\RegisterController"

and the controller:

namespace OZ\LineBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Voryx\ThruwayBundle\Annotation\Register;

class RegisterController extends Controller
{
    /**
     * @Register("user.line.open")
     */
    public function userLineOpenAction($threadID)
    {
        try {
            $user = $this->container->getUser();  //this will make the action doesn't work.
            return $user->getUsername();   // it will make client get nothing
//            return $threadID;
        } catch (\Exception $exc) {
            return $exc->getMessage();
        }   //eof try          
    }     

the client side code:

Connection.session.call('user.line.open', [ Defaults.threadID ]).then(function(arg){
    console.log(arg);
});    

If the action is like this, the register can work and the client can response the response data.

    /**
     * @Register("user.line.open")
     */
    public function userLineOpenAction($threadID)
    {
           return $threadID;        
    }     

What's error with my code?
And how to get container service in Register action?

Thank you.

How handle dynamic topic ?

Hi,

Simple question, how can I handle dynamic topic ? Simple use case, when you have a chat and you allow your client to create new room. Each room is a topic and when people enter in it, they subscribe to this room and publish.

I'm blocked with this feature because of @subscribe("chat/room1"), how handle chat/roomX ?

Currently I dont find a way to do that.

Add logger configuration example to documentation

If it's possible to use another PSR-3 logger, can you update the documentation to reflect how that's done, and also how to adjust the debug level.

Ideally --verbose (and --v, -vv, -vvv) would control the router and worker output in some way, but at least configurating it to not display INFO calls would make the output more useful.

Async user provider

It would be nice, to have some kind of async user provider or some configured WAMP procedure for that, something like the crossbar.io fetches the credentials (http://crossbar.io/docs/WAMP-CRA-Authentication/#dynamic-credentials)

Suppose, I want to have separate app that responsible only for the authentication and all user stuff.

At this moment, for the authorization I need the user provider in all apps, and it used synchronously in the private WampKernel::authenticateAuthId method.

The feature request - make it possible to authorize RPC caller in any app, in additional don't need to put the user provider in the all symfony apps which don't related to any user persistence stuff.

What is "locations" used for?

Dear Sir,

I just try to implement to my project, but I can't figure out what "locations" setting in config.yml is used for.
May I have an example or some tips?
thanks.

locations:
    bundles: ["AppBundle"]
    files:
        - "Acme\\DemoBundle\\Controller\\DemoController"

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.