smancke/guble

`MsgAndRoute` is obsolete

bogh opened this issue · 1 comments

bogh commented

The channel that belongs to Route should send only message through it. No need to send the route also.

If you send through the route channel Router.C or receive you already have access to the route.
The channel should also be built inside the NewRoute constructor and not receive from exterior. Only if there aren't special cases where this is required.

The intention to have both there as as following:
A subscriber could have multiple subscriptions described by routes, which all are delivered over the same channel (the subscriber always supplies the same channel with every new route). Than it is a good idea to have the route, which was matched by the router also, supplied, because the subscriber can not identify it by the id of the channel.

This is used within the GCMConnector.sendMessageToGCM(): At the first line of the method, the application id is taken from the route to get an idea, where the connector should deliver the message to.

I even had the idea to give the route a generic field of type interface{} where the subscriber could add any callback context, it likes.