-
Notifications
You must be signed in to change notification settings - Fork 0
Home
It follows Post - Subscription protocol similar to RabbitmQ. The framework is written in Swift with OBJ-C elements based on the market maturity.
Example of using event bus SWIFT import mobilefwsdk
to subscribe to events of the bus in the any point in any type of object add the following lines:
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(MainViewController.consumeMessage(_:)), name: "internal.<message routing key>", object: nil)
to send message to a bus:
let msg: Message = Message(routKey: "internal.apiresponse") msg.params = ["api":api, "data":responseObject] msg.passthruAPI = passThruAPI
every object that is subscribed to an event should implement the following method:
func consumeMessage(notif:NSNotification){ let msg:Message = notif.userInfo?["message"] as! Message switch (msg.routingKey) { case "internal.apiresponse": ..... break }