keechma

Keechma stack. Mention @U050986L9 or @U2J1PHYNM if you have any questions
roberto 2016-04-05T03:19:30.000102Z

is there a way to trigger a message from within a Controller’s params function?

mihaelkonjevic 2016-04-05T07:26:50.000103Z

@roberto you could, but it would go to the wrong "instance" of the controller. Params function is called before the controller is started. Why not calling it from the start function?

roberto 2016-04-05T13:27:53.000104Z

I probably don’t understand the lifecycle of a component.

roberto 2016-04-05T13:28:35.000105Z

the start function only gets called once, right?

roberto 2016-04-05T13:28:47.000106Z

while the params function gets called everytime the url changes?

roberto 2016-04-05T13:29:32.000107Z

I have a component that is already rendered, and want to modify it everytime the url changes.

mihaelkonjevic 2016-04-05T13:37:15.000108Z

oh

mihaelkonjevic 2016-04-05T13:37:28.000109Z

you get the route-changed command sent through the in-chan everytime route changes

mihaelkonjevic 2016-04-05T13:38:18.000114Z

@roberto ^

roberto 2016-04-05T13:39:04.000115Z

ah

roberto 2016-04-05T13:39:06.000116Z

thank you

roberto 2016-04-05T13:39:09.000117Z

that is very helpful

roberto 2016-04-05T13:39:47.000118Z

I didn’t think to look inside that file. Didn’t understand its purpose

mihaelkonjevic 2016-04-05T13:40:20.000119Z

it basically clears the stale data from the entity db on each route change

roberto 2016-04-05T13:41:10.000120Z

so you can have a controller that is not associated with any component

mihaelkonjevic 2016-04-05T13:43:08.000121Z

yeah

mihaelkonjevic 2016-04-05T13:43:17.000122Z

controllers operate on the route

mihaelkonjevic 2016-04-05T13:43:25.000123Z

they don't really care about components

roberto 2016-04-05T13:43:51.000124Z

okay, I think it is kind of clicking. So, the only way a component can be linked to a controller is via its topic. And it can only be associated to one topic, hence only to one controller.

mihaelkonjevic 2016-04-05T13:43:57.000125Z

yeah

roberto 2016-04-05T13:44:29.000126Z

but that doesn’t restrict it from sending commands to other controllers using the send-command, right?

mihaelkonjevic 2016-04-05T13:44:52.000127Z

it does because the component's send command will always send it on it's one topic

mihaelkonjevic 2016-04-05T13:44:59.000128Z

but if you need to broadcast the message

mihaelkonjevic 2016-04-05T13:45:44.000129Z

theoretically you could add a transducer

mihaelkonjevic 2016-04-05T13:45:47.000130Z

on teh command channel

mihaelkonjevic 2016-04-05T13:45:51.000131Z

and duplicate commands

roberto 2016-04-05T13:45:54.000132Z

ah, so change the url if you want to broadcast?

mihaelkonjevic 2016-04-05T13:45:55.000133Z

to various topics

mihaelkonjevic 2016-04-05T13:45:59.000134Z

yeah

roberto 2016-04-05T13:46:06.000135Z

okay, that sounds cleaner

mihaelkonjevic 2016-04-05T13:46:10.000136Z

also, controllers can send commands to other controllers

mihaelkonjevic 2016-04-05T13:46:25.000137Z

so you could have a controller that relays commands from the component to other controllers

roberto 2016-04-05T13:47:06.000139Z

cool, yeah I did that with a search component

roberto 2016-04-05T13:47:15.000140Z

but I don’t think I understood what I was doing :simple_smile:

roberto 2016-04-05T13:47:37.000141Z

it is becoming clearer now.