Skip to content

Instantly share code, notes, and snippets.

@alexspeller
Created September 28, 2013 14:34
Show Gist options
  • Save alexspeller/6742679 to your computer and use it in GitHub Desktop.
Save alexspeller/6742679 to your computer and use it in GitHub Desktop.
App.PushClient = Em.Object.extend
init: ->
@connection = connectToSocketIOSomehow()
subscribe: (channel, callback) ->
@connection.subscribe channel, callback
App.register 'pushClient:main', App.PushClient
App.inject 'router', 'pushClient', 'pushClient:main' # inject pushClient into router
# optional
App.inject 'pushClient', 'store', 'store:main' #inject store into pushClient
App.inject 'pushClient', 'router', 'router:main' #incject router into pushClient
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment