Amoeba
Amoeba

Reputation: 75

Where to place application logic in a Thruway app?

I build an app with Thruway and Autobahn.js This is the first time I use these tech, and I am a little lost with Thruway code. I read in a stackoverflow thread that :

“All application specific code should reside in WAMP application components, not in the router itself.”

But put these specific code where, how ?

For example, if a client subscribe to a chatroom, and the app need to log some thing, write in DB, manage sessions, (usual things)... In facts, for each of type of message hello, error, subscribe, publish, etc...

If any of you have any code, it will be great. For me and for others dev, as I found no example in the ex. directory of Thruway.

Thanks

Upvotes: 1

Views: 378

Answers (2)

chervand
chervand

Reputation: 83

You should implement internal client\clients and assign it directly to the router instance.

$router->addInternalClient(new InternalClient());

More info here http://voryx.net/creating-internal-client-thruway/

Upvotes: 1

gzost
gzost

Reputation: 2445

I have no idea about Thruway specifically, but generally: you can run WAMP components however you like. Any application written in a language for which a WAMP client library exists can be a WAMP component and connect to a WAMP router (like to Thruway, Crossbar.io etc.). There is no special mechanism for running them.

Upvotes: 2

Related Questions